summaryrefslogtreecommitdiff
path: root/t/t7600-merge.sh
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-07-02 14:47:57 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-07-02 20:08:42 (GMT)
commita54841e96b78203598dea6b31b9618f40f107e7b (patch)
tree76465742ce499ceed97377fe792e881e0a5da1bb /t/t7600-merge.sh
parent7a3187eb788854ed3a20fee30b27e68430f753b7 (diff)
downloadgit-a54841e96b78203598dea6b31b9618f40f107e7b.zip
git-a54841e96b78203598dea6b31b9618f40f107e7b.tar.gz
git-a54841e96b78203598dea6b31b9618f40f107e7b.tar.bz2
merge: handle --ff/--no-ff/--ff-only as a tri-state option
These three options mean "favor fast-forwarding when possible, without creating an unnecessary merge", "never fast-forward and always create a merge commit even when the commit being merged is a strict descendant", and "we do not want to create any merge commit; update only when the merged commit is a strict descendant". They are "pick one out of these three possibilities" options, and correspond to "merge.ff" configuration that is tri-state (yes, no and only). However, the implementation did not follow the usual convention for the command line options (later one wins, and command line overrides what is in the configuration). Fix this by consolidating two variables (fast_forward_only and allow_fast_forward) used in the implementation into one enum that can take one of the three possible values. Signed-off-by: Miklos Vajna <vmiklos@suse.cz> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7600-merge.sh')
-rwxr-xr-xt/t7600-merge.sh12
1 files changed, 9 insertions, 3 deletions
diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index 460d8eb..3ff5fb8 100755
--- a/t/t7600-merge.sh
+++ b/t/t7600-merge.sh
@@ -497,9 +497,15 @@ test_expect_success 'combining --squash and --no-ff is refused' '
test_must_fail git merge --no-ff --squash c1
'
-test_expect_success 'combining --ff-only and --no-ff is refused' '
- test_must_fail git merge --ff-only --no-ff c1 &&
- test_must_fail git merge --no-ff --ff-only 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
+'
+
+test_expect_success 'option --ff-only overwrites merge.ff=only config' '
+ git reset --hard c0 &&
+ test_config merge.ff only &&
+ git merge --no-ff c1
'
test_expect_success 'merge c0 with c1 (ff overrides no-ff)' '