1
0
mirror of https://github.com/git/git.git synced 2024-11-15 17:03:14 +01:00

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
This commit is contained in:
Junio C Hamano 2024-02-14 15:36:05 -08:00
commit c036a145c3
2 changed files with 13 additions and 0 deletions

@ -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 */

@ -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 &&