Re: [PATCH] git add -e documentation: rephrase note

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

 



On Thu, Oct 15, 2009 at 12:26:28AM +0200, Miklos Vajna wrote:

> The original note probably wanted to suggest "edit the patch with care",
> but actually suggested just editing the first characters on certain
> lines, which is a pretty bad suggestion.

The intent of "-e" is to pick and choose lines of the diff to apply, or
even to munge the lines. So it is safe to:

  - remove lines with a '+' (don't stage the addition)

  - munge any lines with a '+' (stage modified contents)

  - add lines with a '+' (stage an addition)

  - convert lines with a ' ' to '-' (stage removal)

  - convert lines with a '-' to ' ' (don't stage removal)

It is a bad idea to:

  - delete '-' lines

  - delete ' ' lines

  - add ' ' or '-' line

  - munge the contents of ' ' or '-' lines

But that is just off the top of my head; perhaps others can come up with
corner cases where one of the safe things breaks.

> -*NOTE*: Obviously, if you change anything else than the first character
> -on lines beginning with a space or a minus, the patch will no longer
> -apply.
> +*NOTE*: Obviously, if you change the first characters of the lines or
> +lines beginning with a space or a minus, the patch will no longer apply.

So this is warning about changing or deleting ' ' or '-' lines, which is
good. But you can change the first characters of those lines, but only
by interchanging the two. So I think both the previous text and your
text don't cover all cases.

Maybe it makes sense instead to do a quick overview of what is OK and
what is not (like the list above).

-Peff
--
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]