diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-11-02 13:17:43 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-11-02 13:17:43 -0800 |
commit | 73af6a4fab3fc570e234f5836dc1e59c3270a716 (patch) | |
tree | ea53b35e93c552d780776e2d788559951369b462 | |
parent | Merge branch 'en/test-selector' (diff) | |
parent | t3435: add tests for rebase -r GPG signing (diff) | |
download | tgif-73af6a4fab3fc570e234f5836dc1e59c3270a716.tar.xz |
Merge branch 'sc/sequencer-gpg-octopus'
"git rebase --rebase-merges" did not correctly pass --gpg-sign
command line option to underlying "git merge" when replaying a merge
using non-default merge strategy or when replaying an octopus merge
(because replaying a two-head merge with the default strategy was
done in a separate codepath, the problem did not trigger for most
users), which has been corrected.
* sc/sequencer-gpg-octopus:
t3435: add tests for rebase -r GPG signing
sequencer: pass explicit --no-gpg-sign to merge
sequencer: fix gpg option passed to merge subcommand
-rw-r--r-- | sequencer.c | 4 | ||||
-rwxr-xr-x | t/t3435-rebase-gpg-sign.sh | 56 |
2 files changed, 59 insertions, 1 deletions
diff --git a/sequencer.c b/sequencer.c index d76cbded00..c358100299 100644 --- a/sequencer.c +++ b/sequencer.c @@ -3677,7 +3677,9 @@ static int do_merge(struct repository *r, strvec_push(&cmd.args, "-F"); strvec_push(&cmd.args, git_path_merge_msg(r)); if (opts->gpg_sign) - strvec_push(&cmd.args, opts->gpg_sign); + strvec_pushf(&cmd.args, "-S%s", opts->gpg_sign); + else + strvec_push(&cmd.args, "--no-gpg-sign"); /* Add the tips to be merged */ for (j = to_merge; j; j = j->next) diff --git a/t/t3435-rebase-gpg-sign.sh b/t/t3435-rebase-gpg-sign.sh index b47c59c190..54120b09d6 100755 --- a/t/t3435-rebase-gpg-sign.sh +++ b/t/t3435-rebase-gpg-sign.sh @@ -68,4 +68,60 @@ test_expect_failure 'rebase -p --no-gpg-sign override commit.gpgsign' ' test_must_fail git verify-commit HEAD ' +test_expect_success 'rebase -r, merge strategy, --gpg-sign will sign commit' ' + git reset --hard merged && + test_unconfig commit.gpgsign && + git rebase -fr --gpg-sign -s resolve --root && + git verify-commit HEAD +' + +test_expect_success 'rebase -r, merge strategy, commit.gpgsign=true will sign commit' ' + git reset --hard merged && + git config commit.gpgsign true && + git rebase -fr -s resolve --root && + git verify-commit HEAD +' + +test_expect_success 'rebase -r, merge strategy, commit.gpgsign=false --gpg-sign will sign commit' ' + git reset --hard merged && + git config commit.gpgsign false && + git rebase -fr --gpg-sign -s resolve --root && + git verify-commit HEAD +' + +test_expect_success "rebase -r, merge strategy, commit.gpgsign=true --no-gpg-sign won't sign commit" ' + git reset --hard merged && + git config commit.gpgsign true && + git rebase -fr --no-gpg-sign -s resolve --root && + test_must_fail git verify-commit HEAD +' + +test_expect_success 'rebase -r --gpg-sign will sign commit' ' + git reset --hard merged && + test_unconfig commit.gpgsign && + git rebase -fr --gpg-sign --root && + git verify-commit HEAD +' + +test_expect_success 'rebase -r with commit.gpgsign=true will sign commit' ' + git reset --hard merged && + git config commit.gpgsign true && + git rebase -fr --root && + git verify-commit HEAD +' + +test_expect_success 'rebase -r --gpg-sign with commit.gpgsign=false will sign commit' ' + git reset --hard merged && + git config commit.gpgsign false && + git rebase -fr --gpg-sign --root && + git verify-commit HEAD +' + +test_expect_success "rebase -r --no-gpg-sign with commit.gpgsign=true won't sign commit" ' + git reset --hard merged && + git config commit.gpgsign true && + git rebase -fr --no-gpg-sign --root && + test_must_fail git verify-commit HEAD +' + test_done |