From: Junio C Hamano <junkio@cox.net>
To: git@vger.kernel.org
Subject: [PATCH 4/4] Add a demonstration/test of customized merge.
Date: Tue, 17 Apr 2007 01:08:38 -0700 [thread overview]
Message-ID: <11767973192181-git-send-email-junkio@cox.net> (raw)
In-Reply-To: <11767973183627-git-send-email-junkio@cox.net>
This demonstrates how the new low-level per-path merge backends,
union and ours, and shows how they are controlled by the
gitattribute mechanism.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
t/t6026-merge-attr.sh | 72 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 72 insertions(+), 0 deletions(-)
create mode 100755 t/t6026-merge-attr.sh
diff --git a/t/t6026-merge-attr.sh b/t/t6026-merge-attr.sh
new file mode 100755
index 0000000..5daa223
--- /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
--
1.5.1.1.821.g88bdb
prev parent reply other threads:[~2007-04-17 8:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-17 8:08 [PATCH 1/4] Allow more than true/false to attributes Junio C Hamano
2007-04-17 8:08 ` [PATCH 2/4] merge-recursive: separate out xdl_merge() interface Junio C Hamano
2007-04-17 8:08 ` [PATCH 3/4] Allow specifying specialized merge-backend per path Junio C Hamano
2007-04-17 9:20 ` Junio C Hamano
2007-04-17 15:16 ` Linus Torvalds
2007-04-17 8:08 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11767973192181-git-send-email-junkio@cox.net \
--to=junkio@cox.net \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).