path: root/t/
diff options
authorVishal Verma <>2019-05-24 18:36:17 (GMT)
committerJunio C Hamano <>2019-05-28 18:53:11 (GMT)
commit1d14d0c9949c02260fe4f8b3a54a1b5c605823a2 (patch)
treeddafb00ad119393fe27fd594541f757a0fb46270 /t/
parentaeb582a98374c094361cba1bd756dc6307432c42 (diff)
merge: refuse --commit with --squash
Convert option_commit to tristate, representing the states of 'default/untouched', 'enabled-by-cli', 'disabled-by-cli'. With this in place, check whether option_commit was enabled by cli when squashing a merge. If so, error out, as this is not supported. Previously, when --squash was supplied, 'option_commit' was silently dropped. This could have been surprising to a user who tried to override the no-commit behavior of squash using --commit explicitly. Add a note to the --squash option for git-merge to clarify the incompatibility, and add a test case to Cc: Junio C Hamano <> Cc: Rafael Ascensão <> Cc: Johannes Schindelin <> Signed-off-by: Vishal Verma <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 't/')
1 files changed, 6 insertions, 0 deletions
diff --git a/t/ b/t/
index 1061482..eeb2222 100755
--- a/t/
+++ b/t/
@@ -525,6 +525,12 @@ test_expect_success 'combining --squash and --no-ff is refused' '
test_must_fail git merge --no-ff --squash c1
+test_expect_success 'combining --squash and --commit is refused' '
+ git reset --hard c0 &&
+ test_must_fail git merge --squash --commit c1 &&
+ test_must_fail git merge --commit --squash c1
test_expect_success 'option --ff-only overwrites --no-ff' '
git merge --no-ff --ff-only c1 &&
test_must_fail git merge --no-ff --ff-only c2