git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Regression in patch add?

From
PWPhillip Wood <phillip.wood@talktalk.net>
Date
Apr 16, 2018, 10:01 UTC
Message-ID
<aa2599d6-6349-0c98-6a31-f68c8b8bf0f8@talktalk.net>
In-Reply-To
<CAN0heSqCZWR1OD4k+-_OBdtCjCNW-UexLo4P-C5XyBqfU6KBEA@mail.gmail.com>
On 15/04/18 14:59, Martin Ågren wrote:
Show 50 quoted lines
> 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:
> 
> [...]
> 
>> 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')
> ...
That's a good idea to try
> Adding Phillip to cc, since he was recently working in this area
Thanks for cc-ing me
> and might have an idea.
I wish I did!
Best Wishes
Phillip
> 
> Martin
> 
Previous: Martin ÅgrenNext: Phillip Wood
Message 3 of 22 in “Regression in patch add?”
  1. mqudsi@neosmart.netApr 15, 2018
  2. Martin ÅgrenApr 15, 2018
  3. Phillip WoodApr 16, 2018
  4. Phillip WoodApr 16, 2018
  5. Oliver Joseph AshMay 10, 2018
  6. Martin ÅgrenMay 10, 2018
  7. Oliver Joseph AshMay 10, 2018
  8. Martin ÅgrenMay 10, 2018
  9. Phillip WoodMay 10, 2018
  10. Oliver Joseph AshMay 10, 2018
  11. Phillip WoodMay 10, 2018
  12. Junio C HamanoMay 11, 2018
  13. Phillip WoodMay 11, 2018
  14. Oliver Joseph AshMay 10, 2018
  15. add -p: fix counting empty context lines in edited patchesPhillip Wood, Jun 1, 2018
  16. Jacob KellerJun 1, 2018
  17. Eric SunshineJun 1, 2018
  18. Phillip WoodJun 4, 2018
  19. Eric SunshineJun 4, 2018
  20. add -p: fix counting empty context lines in edited patchesPhillip Wood, Jun 11, 2018
  21. Jeff FelchnerJul 11, 2018
  22. Junio C HamanoJul 11, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.