summaryrefslogtreecommitdiff
path: root/t/t7601-merge-pull-config.sh
diff options
context:
space:
mode:
authorDavid Aguilar <davvid@gmail.com>2014-01-15 15:18:38 -0800
committerJunio C Hamano <gitster@pobox.com>2014-01-15 16:01:06 -0800
commitb814da891e8261b909fc5d9fb07b4e8b13989c2d (patch)
tree20bdca746012df5441dbfc5bdaab9a75e9649c7d /t/t7601-merge-pull-config.sh
parent4224916ae979204f13db2996d9e32490e0acb90f (diff)
downloadgit-b814da891e8261b909fc5d9fb07b4e8b13989c2d.tar.gz
pull: add pull.ff configuration
Add a `pull.ff` configuration option that is analogous to the `merge.ff` option. This allows us to control the fast-forward behavior for pull-initiated merges only. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7601-merge-pull-config.sh')
-rwxr-xr-xt/t7601-merge-pull-config.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/t/t7601-merge-pull-config.sh b/t/t7601-merge-pull-config.sh
index 830a4c3e9d..f768c900ab 100755
--- a/t/t7601-merge-pull-config.sh
+++ b/t/t7601-merge-pull-config.sh
@@ -38,6 +38,27 @@ test_expect_success 'merge c1 with c2' '
test -f c2.c
'
+test_expect_success 'fast-forward pull succeeds with "true" in pull.ff' '
+ git reset --hard c0 &&
+ test_config pull.ff true &&
+ git pull . c1 &&
+ test "$(git rev-parse HEAD)" = "$(git rev-parse c1)"
+'
+
+test_expect_success 'fast-forward pull creates merge with "false" in pull.ff' '
+ git reset --hard c0 &&
+ test_config pull.ff false &&
+ git pull . c1 &&
+ test "$(git rev-parse HEAD^1)" = "$(git rev-parse c0)" &&
+ test "$(git rev-parse HEAD^2)" = "$(git rev-parse c1)"
+'
+
+test_expect_success 'pull prevents non-fast-forward with "only" in pull.ff' '
+ git reset --hard c1 &&
+ test_config pull.ff only &&
+ test_must_fail git pull . c3
+'
+
test_expect_success 'merge c1 with c2 (ours in pull.twohead)' '
git reset --hard c1 &&
git config pull.twohead ours &&