Re: [RFC PATCH v5 2/4] add -p: select modified lines correctly

2018-07-27 Thread Junio C Hamano
Phillip Wood writes: > The code actually looks at the lines that are selected rather than > omitted. So in the example above it groups them as [1,2] (because they > are contiguous), [4],[5] (these are split because one is an insertion > and one a deletion) and [7]. It then sees that there are

Re: [RFC PATCH v5 2/4] add -p: select modified lines correctly

2018-07-27 Thread Phillip Wood
Hi Junio, thanks for the comments On 26/07/18 20:30, Junio C Hamano wrote: > Phillip Wood writes: > > An interesting problem you are solving ;-) > >> For example given the hunk >> 1 -* a longer description of the >> 2 - first item >> 3 -* second >> 4 -* third >>

Re: [RFC PATCH v5 2/4] add -p: select modified lines correctly

2018-07-26 Thread Junio C Hamano
Phillip Wood writes: An interesting problem you are solving ;-) > For example given the hunk > 1 -* a longer description of the > 2 - first item > 3 -* second > 4 -* third > 5 +* first > 6 + second item > 7 +* the third item > > If the user selects

[RFC PATCH v5 2/4] add -p: select modified lines correctly

2018-07-26 Thread Phillip Wood
From: Phillip Wood When a set of lines is modified the hunk contains deletions followed by insertions. To correctly stage a subset of the modified lines we need to match up the selected deletions with the selected insertions otherwise we end up with deletions and context lines followed by