sequencer: unset GIT_CHERRY_PICK_HELP for 'exec' commands

Running "git cherry-pick" as an x-command in the rebase plan loses the original authorship information. To fix this, unset GIT_CHERRY_PICK_HELP for 'exec' commands. Helped-by: Phillip Wood <phillip.wood123@gmail.com> Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Vegard Nossum committed Feb 2, 2024 at 10:18 UTC e4301f73fffacf2ba9fb2042b95de32880381e72
2 files changed +13
sequencer.c
+1
@@ -3647,6 +3647,7 @@ static int do_exec(struct repository *r, const char *command_line)
3647 fprintf(stderr, _("Executing: %s\n"), command_line);
3648 cmd.use_shell = 1;
3649 strvec_push(&cmd.args, command_line);
3650 + strvec_push(&cmd.env, "GIT_CHERRY_PICK_HELP");
3651 status = run_command(&cmd);
3652
3653 /* force re-reading of the cache */
t/t3404-rebase-interactive.sh
+12
@@ -153,6 +153,18 @@ test_expect_success 'rebase -i with the exec command checks tree cleanness' '
153 git rebase --continue
154 '
155
156 +test_expect_success 'cherry-pick works with rebase --exec' '
157 + test_when_finished "git cherry-pick --abort; \
158 + git rebase --abort; \
159 + git checkout primary" &&
160 + echo "exec git cherry-pick G" >todo &&
161 + (
162 + set_replace_editor todo &&
163 + test_must_fail git rebase -i D D
164 + ) &&
165 + test_cmp_rev G CHERRY_PICK_HEAD
166 +'
167 +
168 test_expect_success 'rebase -x with empty command fails' '
169 test_when_finished "git rebase --abort ||:" &&
170 test_must_fail env git rebase -x "" @ 2>actual &&