提交 47579efc 编写于 作者: J Junio C Hamano

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: NJunio C Hamano <junkio@cox.net>
上级 a129d96f
#!/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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册