Re: [PATCH v3] git-add--interactive: manual hunk editing mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes:

> But like I said, Junio convinced me that it makes not much sense to split 
> somewhere else than common lines, and you have that already with the "s" 
> command in add -i.

That needs clarifying.  What I would have convinced you is not quite
"somewhere else than common lines".  It is more like "don't split between
two deleted lines that is followed by addition, or two added lines that
immediately follow deletion, without thinking".

Splitting the left into the right:

         1               1
        -2              -2
        +two            +two
         3               3
        -4
        +four
         5

so that only the first change is applicable makes sense and can easily be
explained.  This is "common lines" case.

The example I gave you long time ago about split that does not make much
sense was to split this:

         1      
        -2      
        -3      
        -4
        +two, three
        +four
         5

anywhere between "-2 .. +four" without giving the user any other ways to
control the result.

But you _can_ give users a meaningful split by reordering lines.

         1      
        -2      
        -3      
        +two, three
        -4
        +four
         5

It makes sense to then split this immediately before "-4" to apply "only
the first change that is to remove two lines and rewrite it with one
line", i.e.:

         1      
        -2      
        -3      
        +two, three
         4

with the leftover part, whose lines differ if the above is applied or not,
presented as the next hunk to the user:

 (if the above is unused) (if the above is used)

         3                   two, three 
        -4                  -4          
        +four               +four       
         5                   5          

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux