aboutsummaryrefslogtreecommitdiff
path: root/t/t6026-merge-attr.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-04-17 00:05:00 -0700
committerJunio C Hamano <junkio@cox.net>2007-04-17 14:21:22 -0700
commit47579efc009c6f7afaf31be107eb92395a4f10db (patch)
treebc4e0adc1980b40c39585277687296000783e414 /t/t6026-merge-attr.sh
parenta129d96f4144215711e379565af97f6a82197f4f (diff)
downloadgit-47579efc009c6f7afaf31be107eb92395a4f10db.tar.gz
git-47579efc009c6f7afaf31be107eb92395a4f10db.tar.xz
Add a demonstration/test of customized merge.
This demonstrates how the new low-level per-path merge backends, union and ours, work, and shows how they are controlled by the gitattribute mechanism. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 't/t6026-merge-attr.sh')
-rwxr-xr-xt/t6026-merge-attr.sh72
1 files changed, 72 insertions, 0 deletions
diff --git a/t/t6026-merge-attr.sh b/t/t6026-merge-attr.sh
new file mode 100755
index 000000000..5daa2236d
--- /dev/null
+++ b/t/t6026-merge-attr.sh
@@ -0,0 +1,72 @@
+#!/bin/sh
+#
+# Copyright (c) 2007 Junio C Hamano
+#
+
+test_description='per path merge controlled by merge attribute'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+
+ for f in text binary union
+ do
+ echo Initial >$f && git add $f || break
+ done &&
+ test_tick &&
+ git commit -m Initial &&
+
+ git branch side &&
+ for f in text binary union
+ do
+ echo Master >>$f && git add $f || break
+ done &&
+ test_tick &&
+ git commit -m Master &&
+
+ git checkout side &&
+ for f in text binary union
+ do
+ echo Side >>$f && git add $f || break
+ done &&
+ test_tick &&
+ git commit -m Side
+
+'
+
+test_expect_success merge '
+
+ {
+ echo "binary -merge"
+ echo "union merge=union"
+ } >.gitattributes &&
+
+ if git merge master
+ then
+ echo Gaah, should have conflicted
+ false
+ else
+ echo Ok, conflicted.
+ fi
+'
+
+test_expect_success 'check merge result in index' '
+
+ git ls-files -u | grep binary &&
+ git ls-files -u | grep text &&
+ ! (git ls-files -u | grep union)
+
+'
+
+test_expect_success 'check merge result in working tree' '
+
+ git cat-file -p HEAD:binary >binary-orig &&
+ grep "<<<<<<<" text &&
+ cmp binary-orig binary &&
+ ! grep "<<<<<<<" union &&
+ grep Master union &&
+ grep Side union
+
+'
+
+test_done