aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-02-14 15:36:05 -0800
committerJunio C Hamano <gitster@pobox.com>2024-02-14 15:36:05 -0800
commitc036a145c380e79db5fab5aafb87c4981e11cc9e (patch)
treea96c28427f19085e4bed0477020057cc3bd64175
parent09e0aa64b3fbdc6df541cd2beefe70170f038252 (diff)
parente4301f73fffacf2ba9fb2042b95de32880381e72 (diff)
downloadgit-c036a145c380e79db5fab5aafb87c4981e11cc9e.tar.gz
Merge branch 'vn/rebase-with-cherry-pick-authorship'
"git cherry-pick" invoked during "git rebase -i" session lost the authorship information, which has been corrected. * vn/rebase-with-cherry-pick-authorship: sequencer: unset GIT_CHERRY_PICK_HELP for 'exec' commands
-rw-r--r--sequencer.c1
-rwxr-xr-xt/t3404-rebase-interactive.sh12
2 files changed, 13 insertions, 0 deletions
diff --git a/sequencer.c b/sequencer.c
index 91de546b32..f49a871ac0 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -3641,6 +3641,7 @@ static int do_exec(struct repository *r, const char *command_line)
fprintf(stderr, _("Executing: %s\n"), command_line);
cmd.use_shell = 1;
strvec_push(&cmd.args, command_line);
+ strvec_push(&cmd.env, "GIT_CHERRY_PICK_HELP");
status = run_command(&cmd);
/* force re-reading of the cache */
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 64b641002e..d1bead61fa 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -153,6 +153,18 @@ test_expect_success 'rebase -i with the exec command checks tree cleanness' '
git rebase --continue
'
+test_expect_success 'cherry-pick works with rebase --exec' '
+ test_when_finished "git cherry-pick --abort; \
+ git rebase --abort; \
+ git checkout primary" &&
+ echo "exec git cherry-pick G" >todo &&
+ (
+ set_replace_editor todo &&
+ test_must_fail git rebase -i D D
+ ) &&
+ test_cmp_rev G CHERRY_PICK_HEAD
+'
+
test_expect_success 'rebase -x with empty command fails' '
test_when_finished "git rebase --abort ||:" &&
test_must_fail env git rebase -x "" @ 2>actual &&