aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-08-27 17:28:31 -0700
committerJunio C Hamano <gitster@pobox.com>2008-08-27 17:28:31 -0700
commita1184d85e8752658f02746982822f43f32316803 (patch)
treef4508ca7d63ca7e71c3e99cac4e54945f777b1aa /t
parent8d13caf795902812d44809e2f222fb2334030603 (diff)
parente596cdddf349b244dca854bf5a7aa9428b48fc50 (diff)
downloadgit-a1184d85e8752658f02746982822f43f32316803.tar.gz
git-a1184d85e8752658f02746982822f43f32316803.tar.xz
Merge branch 'mv/merge-custom'
* mv/merge-custom: t7606: fix custom merge test Fix "git-merge -s bogo" help text Update .gitignore to ignore git-help Builtin git-help. builtin-help: always load_command_list() in cmd_help() Add a second testcase for handling invalid strategies in git-merge Add a new test for using a custom merge strategy builtin-merge: allow using a custom strategy builtin-help: make some internal functions available to other builtins Conflicts: help.c
Diffstat (limited to 't')
-rwxr-xr-xt/t7600-merge.sh4
-rwxr-xr-xt/t7606-merge-custom.sh49
2 files changed, 53 insertions, 0 deletions
diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index dbc90bc41..6a2b12558 100755
--- a/t/t7600-merge.sh
+++ b/t/t7600-merge.sh
@@ -230,6 +230,10 @@ test_expect_success 'test option parsing' '
test_must_fail git merge
'
+test_expect_success 'reject non-strategy with a git-merge-foo name' '
+ test_must_fail git merge -s index c1
+'
+
test_expect_success 'merge c0 with c1' '
git reset --hard c0 &&
git merge c1 &&
diff --git a/t/t7606-merge-custom.sh b/t/t7606-merge-custom.sh
new file mode 100755
index 000000000..de9b6ed5b
--- /dev/null
+++ b/t/t7606-merge-custom.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+test_description='git-merge
+
+Testing a custom strategy.'
+
+. ./test-lib.sh
+
+cat >git-merge-theirs <<EOF
+#!$SHELL_PATH
+eval git read-tree --reset -u \\\$\$#
+EOF
+chmod +x git-merge-theirs
+PATH=.:$PATH
+export PATH
+
+test_expect_success 'setup' '
+ echo c0 >c0.c &&
+ git add c0.c &&
+ git commit -m c0 &&
+ git tag c0 &&
+ echo c1 >c1.c &&
+ git add c1.c &&
+ git commit -m c1 &&
+ git tag c1 &&
+ git reset --hard c0 &&
+ echo c1c1 >c1.c &&
+ echo c2 >c2.c &&
+ git add c1.c c2.c &&
+ git commit -m c2 &&
+ git tag c2
+'
+
+test_expect_success 'merge c2 with a custom strategy' '
+ git reset --hard c1 &&
+ git merge -s theirs c2 &&
+ test "$(git rev-parse c1)" != "$(git rev-parse HEAD)" &&
+ test "$(git rev-parse c1)" = "$(git rev-parse HEAD^1)" &&
+ test "$(git rev-parse c2)" = "$(git rev-parse HEAD^2)" &&
+ test "$(git rev-parse c2^{tree})" = "$(git rev-parse HEAD^{tree})" &&
+ git diff --exit-code &&
+ git diff --exit-code c2 HEAD &&
+ git diff --exit-code c2 &&
+ test -f c0.c &&
+ grep c1c1 c1.c &&
+ test -f c2.c
+'
+
+test_done