diff --git a/builtin/revert.c b/builtin/revert.c index b2cfde7a870863..4cf8056f3ecf3c 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -165,6 +165,7 @@ static int run_sequencer(int argc, const char **argv, const char *prefix, "--ff", opts->allow_ff, "--rerere-autoupdate", opts->allow_rerere_auto == RERERE_AUTOUPDATE, "--no-rerere-autoupdate", opts->allow_rerere_auto == RERERE_NOAUTOUPDATE, + "--keep-redundant-commits", opts->keep_redundant_commits, NULL); } diff --git a/t/t3515-cherry-pick-incompatible-options.sh b/t/t3515-cherry-pick-incompatible-options.sh new file mode 100755 index 00000000000000..6100ab64fd0a15 --- /dev/null +++ b/t/t3515-cherry-pick-incompatible-options.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +test_description='test if cherry-pick detects and aborts on incompatible options' + +. ./test-lib.sh + +test_expect_success setup ' + + echo first > file1 && + git add file1 && + test_tick && + git commit -m "first" && + + echo second > file1 && + git add file1 && + test_tick && + git commit -m "second" +' + +test_expect_success '--keep-redundant-commits is incompatible with operations' ' + test_must_fail git cherry-pick HEAD 2>output && + test_grep "The previous cherry-pick is now empty" output && + test_must_fail git cherry-pick --keep-redundant-commits --continue 2>output && + test_grep "fatal: cherry-pick: --keep-redundant-commits cannot be used with --continue" output && + test_must_fail git cherry-pick --keep-redundant-commits --skip 2>output && + test_grep "fatal: cherry-pick: --keep-redundant-commits cannot be used with --skip" output && + test_must_fail git cherry-pick --keep-redundant-commits --abort 2>output && + test_grep "fatal: cherry-pick: --keep-redundant-commits cannot be used with --abort" output && + test_must_fail git cherry-pick --keep-redundant-commits --quit 2>output && + test_grep "fatal: cherry-pick: --keep-redundant-commits cannot be used with --quit" output && + git cherry-pick --abort +' + +test_done