Re: Regression in patch add?
- From
- Phillip Wood <phillip.wood@talktalk.net>
- Date
- May 11, 2018, 18:23 UTC
- Message-ID
- <9a7d35c7-2889-05e4-f6f3-5706c710d327@talktalk.net>
- In-Reply-To
- <xmqqzi16hpr4.fsf@gitster-ct.c.googlers.com>
On 11/05/18 03:47, Junio C Hamano wrote:
Show 13 quoted lines
> Phillip Wood <phillip.wood@talktalk.net> writes: > >> Yes, I think it probably makes sense to do that. Originally I didn't >> count empty lines as context lines in case the user accidentally added >> some empty lines at the end of the hunk but if 'git apply' does then I >> think 'git add -p' should as well > > I am not sure if "adding to the tail" should be tolerated, but in > any case, newer GNU diff can show an empty unaffected line as an > empty line (unlike traditional unified context format in which such > a line is expressed as a line with a lone SP on it), which is > allowed as "implementation defined" by POSIX.1 [*1*]. Modern "git > apply" knows about this.
Thanks for the reference, I hadn't realized the space was optional.
> If "add -p" parses a patch, it should learn to do so, too.
I'm about to go off line for a while, I'll send a fix when I'm back up and running at next month (unfortunately the reroll of pw/add-p-select will have to wait until then as well)
Best Wishes
Phillip
Show 19 quoted lines
> > [Reference] > > *1* http://pubs.opengroup.org/onlinepubs/9699919799/utilities/diff.html > >> >>> Meanwhile, I can easily configure my editor not to do this for `*.diff` files. >>> >>> Thanks for your help, Phillip and Martin! >> >> Thanks for posting an example so we could test it, it makes it much >> easier to track the problem down >> >> Best Wishes >> >> Phillip >> >>> Mahmoud, does this also explain your problem as per your original post? >>>