path: root/t/
diff options
authorMiklos Vajna <>2013-07-02 14:47:57 (GMT)
committerJunio C Hamano <>2013-07-02 20:08:42 (GMT)
commita54841e96b78203598dea6b31b9618f40f107e7b (patch)
tree76465742ce499ceed97377fe792e881e0a5da1bb /t/
parent7a3187eb788854ed3a20fee30b27e68430f753b7 (diff)
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 <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 't/')
1 files changed, 9 insertions, 3 deletions
diff --git a/t/ b/t/
index 460d8eb..3ff5fb8 100755
--- a/t/
+++ b/t/
@@ -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)' '