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

Regression in patch add?

From
mqudsi@neosmart.net <mqudsi@neosmart.net>
Date
Apr 15, 2018, 12:21 UTC
Message-ID
<01010162c940b8bb-d8139971-3ee2-4cd6-bb19-35126d46753b-000000@us-west-2.amazonses.com>
Hello all,

I'm currently running the latest version of git built from `master`, and I'm running into what appears to be a regression in the behavior of the piecewise `git add -p` when applying a manually edited chunk.

I first run `git add -p`, then manually edit a chunk (after hitting `s` once, if it matters). The chunk originally contains the following:

```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('danilo-augusto/vim-afterglow')

 	"core plugins that change the behavior of vim and how we use it globally
```

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

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'm not sure what to make of this.

Thank you,

Mahmoud Al-Qudsi
NeoSmart Technologies
Next: Martin Ågren
Message 1 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.