git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git crashes in `git commit --patch` with diff.suppressBlankEmpty = true
@ 2024-07-03 14:41 Ilya Tumaykin
  2024-07-04 13:14 ` Phillip Wood
  0 siblings, 1 reply; 12+ messages in thread
From: Ilya Tumaykin @ 2024-07-03 14:41 UTC (permalink / raw)
  To: git

Hello.

`git commit --patch` crashes with diff.suppressBlankEmpty option enabled 
under certain conditions.


Steps to reproduce:
1. Prepare .gitconfig:
[user]
	name = User
	email = user@example.com
[diff]
	suppressBlankEmpty = true

2. Initialize repo:
$ mkdir git_bug && cd git_bug
$ git init
$ echo -e 'test\n\n test \n\ntest' > test.txt
$ git add test.txt
$ git commit test.txt -m 'initial'

3. Make changes:
$ echo -e 'test\n\n test\ntest\n \n' > test.txt

4. Try to commit new changes
$ git commit --patch test.txt

5. Try to split the first hunk, press 's' in the git-commit interactive 
interface.


Actual results:
diff --git a/test.txt b/test.txt
index 366cd4b..611ca9d 100644
--- a/test.txt
+++ b/test.txt
@@ -1,5 +1,6 @@
  test

- test
-
+ test
  test
+
+
(1/1) Stage this hunk [y,n,q,a,d,s,e,p,?]? s
BUG: add-patch.c:994: unhandled diff marker: '
'
Aborted (core dumped)


Expected results:
git-commit splits the hunk and continues.


Comment:
If I set diff.suppressBlankEmpty = false, then I get the expected behavior.

git --version: 2.45.2
OS: up-to-date Fedora 40

-- 
Best regards.
Ilya Tumaykin.

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-07-18 14:23 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-03 14:41 git crashes in `git commit --patch` with diff.suppressBlankEmpty = true Ilya Tumaykin
2024-07-04 13:14 ` Phillip Wood
2024-07-05 16:39   ` Junio C Hamano
2024-07-10  9:36     ` [RFC/PATCH] add-patch: handle splitting hunks with diff.suppressBlankEmpty Jeff King
2024-07-10 13:46       ` Phillip Wood
2024-07-11 21:26         ` Jeff King
2024-07-13 13:19           ` phillip.wood123
2024-07-13 21:21             ` Jeff King
2024-07-18 14:22               ` Phillip Wood
2024-07-18 14:23           ` Phillip Wood
2024-07-10 17:06       ` Junio C Hamano
2024-07-11 21:32         ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).