From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: git@vger.kernel.org
Subject: builtin add interactive regression
Date: Thu, 9 Dec 2021 20:36:25 +0100 [thread overview]
Message-ID: <20211209193625.GA3294@szeder.dev> (raw)
Hi,
This morning 'git add --patch' told me "Sorry, cannot split this hunk"
even though that hunk in question was definitely splittable. Then I
spent my lunch break trying to reproduce the issue, and it turned out
to be a regression in the builtin add interactive (I have
'add.interactive.useBuiltin=true' in my config). The following test
demonstrates this issue:
--- >8 ---
#!/bin/sh
test_description='test'
. ./test-lib.sh
test_expect_success 'builtin interactive add cannot split hunk?!' '
printf "%s\n" 1 2 >file &&
echo a >zzzz &&
git add file zzzz &&
git commit -m initial &&
cat >file <<-\EOF &&
1
add a line
2
add a line at the end (this is important!)
EOF
echo "modify one more file (this, too, is important!)" >zzzz &&
git diff file &&
git -c add.interactive.useBuiltin=false add -u -p >expect &&
git -c add.interactive.useBuiltin=true add -u -p >actual &&
# Uh-oh, "s" (for splitting the hunk) is missing!
test_cmp expect actual
'
test_done
--- 8< ---
This fails with:
+ git -c add.interactive.useBuiltin=false add -u -p
+ git -c add.interactive.useBuiltin=true add -u -p
+ test_cmp expect actual
--- expect 2021-12-09 19:21:23.354461170 +0000
+++ actual 2021-12-09 19:21:23.358461215 +0000
@@ -7,7 +7,7 @@
+add a line
2
+add a line at the end (this is important!)
-(1/1) Stage this hunk [y,n,q,a,d,s,e,?]?
+(1/1) Stage this hunk [y,n,q,a,d,e,?]?
diff --git a/zzzz b/zzzz
index 7898192..84e1b35 100644
--- a/zzzz
error: last command exited with $?=1
not ok 1 - builtin interactive add cannot split hunk?!
So the builtin add interactive doesn't even offer the 's - split the
current hunk into smaller hunks' option, but my finger memory pressed
's' anyway, and then it told me that "Sorry..." message. The scripted
version can split the hunk just fine.
next reply other threads:[~2021-12-09 19:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-09 19:36 SZEDER Gábor [this message]
2021-12-10 14:13 ` builtin add interactive regression Phillip Wood
2021-12-20 14:51 ` Phillip Wood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211209193625.GA3294@szeder.dev \
--to=szeder.dev@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).