summaryrefslogtreecommitdiff
path: root/t/t6037-merge-ours-theirs.sh
diff options
context:
space:
mode:
authorAvery Pennarun <apenwarr@gmail.com>2009-11-26 02:23:55 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-01-18 06:45:06 (GMT)
commit8cc5b29065e19267cbc08b39c34674b02c2e3d59 (patch)
treea7fc209fac5df7d2a9c9a5795fb4f58746ae3840 /t/t6037-merge-ours-theirs.sh
parent73eb40eeaaebc5ebae283c06286b96b4aea00143 (diff)
downloadgit-8cc5b29065e19267cbc08b39c34674b02c2e3d59.zip
git-8cc5b29065e19267cbc08b39c34674b02c2e3d59.tar.gz
git-8cc5b29065e19267cbc08b39c34674b02c2e3d59.tar.bz2
git merge -X<option>
Teach "-X <option>" command line argument to "git merge" that is passed to strategy implementations. "ours" and "theirs" autoresolution introduced by the previous commit can be asked to the recursive strategy. Signed-off-by: Avery Pennarun <apenwarr@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6037-merge-ours-theirs.sh')
-rwxr-xr-xt/t6037-merge-ours-theirs.sh56
1 files changed, 56 insertions, 0 deletions
diff --git a/t/t6037-merge-ours-theirs.sh b/t/t6037-merge-ours-theirs.sh
new file mode 100755
index 0000000..08c9f79
--- /dev/null
+++ b/t/t6037-merge-ours-theirs.sh
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+test_description='Merge-recursive ours and theirs variants'
+. ./test-lib.sh
+
+test_expect_success setup '
+ for i in 1 2 3 4 5 6 7 8 9
+ do
+ echo "$i"
+ done >file &&
+ git add file &&
+ cp file elif &&
+ git commit -m initial &&
+
+ sed -e "s/1/one/" -e "s/9/nine/" >file <elif &&
+ git commit -a -m ours &&
+
+ git checkout -b side HEAD^ &&
+
+ sed -e "s/9/nueve/" >file <elif &&
+ git commit -a -m theirs &&
+
+ git checkout master^0
+'
+
+test_expect_success 'plain recursive - should conflict' '
+ git reset --hard master &&
+ test_must_fail git merge -s recursive side &&
+ grep nine file &&
+ grep nueve file &&
+ ! grep 9 file &&
+ grep one file &&
+ ! grep 1 file
+'
+
+test_expect_success 'recursive favouring theirs' '
+ git reset --hard master &&
+ git merge -s recursive -Xtheirs side &&
+ ! grep nine file &&
+ grep nueve file &&
+ ! grep 9 file &&
+ grep one file &&
+ ! grep 1 file
+'
+
+test_expect_success 'recursive favouring ours' '
+ git reset --hard master &&
+ git merge -s recursive -X ours side &&
+ grep nine file &&
+ ! grep nueve file &&
+ ! grep 9 file &&
+ grep one file &&
+ ! grep 1 file
+'
+
+test_done