From e6d1f76ccf9de037c5479acdd9b6211e80145142 Mon Sep 17 00:00:00 2001 From: Gerrit Pape Date: Mon, 3 Mar 2008 09:22:03 +0000 Subject: git-merge.sh: better handling of combined --squash,--no-ff,--no-commit options git-merge used to use either the --squash,--no-squash, --no-ff,--ff, --no-commit,--commit option, whichever came last in the command line. This lead to some un-intuitive behavior, having git merge --no-commit --no-ff actually commit the merge. Now git-merge respects --no-commit together with --no-ff, as well as other combinations of the options. However, this broke a selftest in t/t7600-merge.sh which expected to have --no-ff completely override the --squash option, so that git merge --squash --no-ff fast-forwards, and makes a merge commit; combining --squash with --no-ff doesn't really make sense though, and is now refused by git-merge. The test is adapted to test --no-ff without the preceding --squash, and another test is added to make sure the --squash --no-ff combination is refused. The unexpected behavior was reported by John Goerzen through http://bing.sdebian.org/468568 Signed-off-by: Gerrit Pape Signed-off-by: Junio C Hamano --- t/t7600-merge.sh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 't/t7600-merge.sh') diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh index 50c51c82fa..5d166280cb 100755 --- a/t/t7600-merge.sh +++ b/t/t7600-merge.sh @@ -419,6 +419,7 @@ test_debug 'gitk --all' test_expect_success 'merge c0 with c1 (no-ff)' ' git reset --hard c0 && + git config branch.master.mergeoptions "" && test_tick && git merge --no-ff c1 && verify_merge file result.1 && @@ -427,6 +428,11 @@ test_expect_success 'merge c0 with c1 (no-ff)' ' test_debug 'gitk --all' +test_expect_success 'combining --squash and --no-ff is refused' ' + test_must_fail git merge --squash --no-ff c1 && + test_must_fail git merge --no-ff --squash c1 +' + test_expect_success 'merge c0 with c1 (ff overrides no-ff)' ' git reset --hard c0 && git config branch.master.mergeoptions "--no-ff" && -- cgit v1.2.3