Hi Mahmoud

On 15 April 2018 at 14:21,  <mqu...@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:

[...]

> 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.

> 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

Reply via email to