Re: Regression in patch add?
- From
- Martin Ågren <martin.agren@gmail.com>
- Date
- Apr 15, 2018, 13:59 UTC
- Message-ID
- <CAN0heSqCZWR1OD4k+-_OBdtCjCNW-UexLo4P-C5XyBqfU6KBEA@mail.gmail.com>
- In-Reply-To
- <01010162c940b8bb-d8139971-3ee2-4cd6-bb19-35126d46753b-000000@us-west-2.amazonses.com>
Hi Mahmoud
On 15 April 2018 at 14:21, <mqudsi@neosmart.net> wrote:
> I first run `git add -p`, then manually edit a chunk (after hitting `s` > once, if it matters). The chunk originally contains the following:
[...]
Show 19 quoted lines
> Under git 2.7.4, I can edit it to the following, which is accepted
> without a problem:
>
> ```diff
> # Manual hunk edit mode -- see bottom for a quick guide
> @@ -20,7 +20,7 @@
> "call dein#add('Shougo/dein.vim', {'rev': 'master'})
>
> " Add or remove your plugins here:
> - " call dein#add('flazz/vim-colorschemes')
> - call dein#add('Haron-Prime/evening_vim')
> + call dein#add('flazz/vim-colorschemes')
> + call dein#add('Haron-Prime/evening_vim')
>
> "core plugins that change the behavior of vim and how we use it globally
> ```
>
> All I did here was remove one `+` line and manually add another (which
> is a variant of the second `-` line).So the line is identical (sans s/^-/+/). Interesting.
Show 6 quoted lines
> Under git 2.17.0.252.gfe0a9ea, the same piece is opened in $VISUAL for > editing (and if left unmodified applies OK), but when modified in the > to the same exact value, after exiting the editor I receive the > following error from git: > > error: patch fragment without header at line 15: @@ -25,7 +25,8 @@
I can't seem to reproduce this with some very simple testing. Are you able to share your files? Or even better, derive a minimal reproduction recipe?
What happens if you do not do a "remove this line, then add it again", but instead turn that unchanged line into context? That is, you edit the hunk into something like this (but without white-space damage):
...
- " call dein#add('flazz/vim-colorschemes')
+ call dein#add('flazz/vim-colorschemes')
call dein#add('Haron-Prime/evening_vim')
...Adding Phillip to cc, since he was recently working in this area and might have an idea.
Martin