]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'vn/rebase-with-cherry-pick-authorship'
authorJunio C Hamano <gitster@pobox.com>
Wed, 14 Feb 2024 23:36:05 +0000 (15:36 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 14 Feb 2024 23:36:05 +0000 (15:36 -0800)
"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

sequencer.c
t/t3404-rebase-interactive.sh

index 91de546b323e30022e0428628b594ac9174f2ae5..f49a871ac0666b10393331ed3c9b611921f1039e 100644 (file)
@@ -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 */
index 64b641002e4fdb049d7f958cdc54335f9c0f34ce..d1bead61fad03d8a847d75062ede8ad852f7d8e6 100755 (executable)
@@ -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 &&