-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cherry-pick: Enforce
--keep-redundant-commits
incompatibility
When `--keep-redundant-commits` was added in b27cfb0 (git-cherry-pick: Add keep-redundant-commits option, 2012-04-20), it was not marked as incompatible with the various operations needed to continue or exit a cherry-pick (`--continue`, `--skip`, `--abort`, and `--quit`). Enforce this incompatibility via `verify_opt_compatible` like we do for the other various options.
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |