2005-05-14 12:46:46 +04:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 2005 Junio C Hamano
|
|
|
|
#
|
|
|
|
|
|
|
|
test_description='Three way merge with read-tree -m
|
|
|
|
|
|
|
|
This test tries three-way merge with read-tree -m
|
|
|
|
|
|
|
|
There is one ancestor (called O for Original) and two branches A
|
|
|
|
and B derived from it. We want to do a 3-way merge between A and
|
|
|
|
B, using O as the common ancestor.
|
|
|
|
|
|
|
|
merge A O B
|
|
|
|
|
|
|
|
Decisions are made by comparing contents of O, A and B pathname
|
|
|
|
by pathname. The result is determined by the following guiding
|
|
|
|
principle:
|
|
|
|
|
|
|
|
- If only A does something to it and B does not touch it, take
|
|
|
|
whatever A does.
|
|
|
|
|
|
|
|
- If only B does something to it and A does not touch it, take
|
|
|
|
whatever B does.
|
|
|
|
|
|
|
|
- If both A and B does something but in the same way, take
|
|
|
|
whatever they do.
|
|
|
|
|
|
|
|
- If A and B does something but different things, we need a
|
|
|
|
3-way merge:
|
|
|
|
|
|
|
|
- We cannot do anything about the following cases:
|
|
|
|
|
|
|
|
* O does not have it. A and B both must be adding to the
|
|
|
|
same path independently.
|
|
|
|
|
|
|
|
* A deletes it. B must be modifying.
|
|
|
|
|
|
|
|
- Otherwise, A and B are modifying. Run 3-way merge.
|
|
|
|
|
|
|
|
First, the case matrix.
|
|
|
|
|
|
|
|
- Vertical axis is for A'\''s actions.
|
|
|
|
- Horizontal axis is for B'\''s actions.
|
|
|
|
|
|
|
|
.----------------------------------------------------------------.
|
|
|
|
| A B | No Action | Delete | Modify | Add |
|
|
|
|
|------------+------------+------------+------------+------------|
|
|
|
|
| No Action | | | | |
|
|
|
|
| | select O | delete | select B | select B |
|
|
|
|
| | | | | |
|
|
|
|
|------------+------------+------------+------------+------------|
|
|
|
|
| Delete | | | ********** | can |
|
|
|
|
| | delete | delete | merge | not |
|
|
|
|
| | | | | happen |
|
|
|
|
|------------+------------+------------+------------+------------|
|
|
|
|
| Modify | | ********** | ?????????? | can |
|
|
|
|
| | select A | merge | select A=B | not |
|
|
|
|
| | | | merge | happen |
|
|
|
|
|------------+------------+------------+------------+------------|
|
|
|
|
| Add | | can | can | ?????????? |
|
|
|
|
| | select A | not | not | select A=B |
|
|
|
|
| | | happen | happen | merge |
|
|
|
|
.----------------------------------------------------------------.
|
|
|
|
|
|
|
|
In addition:
|
|
|
|
|
|
|
|
SS: a special case of MM, where A and B makes the same modification.
|
|
|
|
LL: a special case of AA, where A and B creates the same file.
|
|
|
|
TT: a special case of MM, where A and B makes mergeable changes.
|
|
|
|
DF: a special case, where A makes a directory and B makes a file.
|
|
|
|
|
|
|
|
'
|
|
|
|
. ./test-lib.sh
|
2011-05-26 00:10:41 +04:00
|
|
|
. "$TEST_DIRECTORY"/lib-read-tree.sh
|
2008-08-08 13:26:28 +04:00
|
|
|
. "$TEST_DIRECTORY"/lib-read-tree-m-3way.sh
|
2005-05-14 12:46:46 +04:00
|
|
|
|
|
|
|
################################################################
|
2005-06-11 13:50:51 +04:00
|
|
|
# Trivial "majority when 3 stages exist" merge plus #2ALT, #3ALT
|
|
|
|
# and #5ALT trivial merges.
|
2005-05-14 12:46:46 +04:00
|
|
|
|
|
|
|
cat >expected <<\EOF
|
2005-05-27 01:38:19 +04:00
|
|
|
100644 X 2 AA
|
|
|
|
100644 X 3 AA
|
2005-06-11 13:50:51 +04:00
|
|
|
100644 X 0 AN
|
2005-05-27 01:38:19 +04:00
|
|
|
100644 X 1 DD
|
|
|
|
100644 X 3 DF
|
|
|
|
100644 X 2 DF/DF
|
|
|
|
100644 X 1 DM
|
|
|
|
100644 X 3 DM
|
|
|
|
100644 X 1 DN
|
|
|
|
100644 X 3 DN
|
[PATCH] read-tree: fix too strong index requirement #5ALT
This fixes too strong index requirement 3-way merge enforces in
one case: the same file is added in both branches.
In this case, the original code insisted that if the index file
has that path, it must match our branch and be up-to-date.
However in this particular case, it only has to match it, and
can be dirty. We just need to make sure that we keep the
work-tree copy instead of checking out the merge result.
The resolution of such a path, however, cannot be left to
outside script, because we will not keep the original stage0
entries for unmerged paths when read-tree finishes, and at that
point, the knowledge of "if we resolve it to match the new file
added in both branches, the merge succeeds and the work tree
would not lose information, but we should _not_ update the work
tree from the resulting index file" is lost. For this reason,
the now code needs to resolve this case (#5ALT) internally.
This affects some existing tests in the test suite, but all in
positive ways. In t1000 (3-way test), this #5ALT case now gets
one stage0 entry, instead of an identical stage2 and stage3
entry pair, for such a path, and one test that checked for merge
failure (because the test assumed the "stricter-than-necessary"
behaviour) does not have to fail anymore. In t1005 (emu23
test), two tests that involves a case where the work tree
already had a change introduced in the upstream (aka "merged
head"), the merge succeeds instead of failing.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-11 05:37:47 +04:00
|
|
|
100644 X 0 LL
|
2005-05-27 01:38:19 +04:00
|
|
|
100644 X 1 MD
|
|
|
|
100644 X 2 MD
|
|
|
|
100644 X 1 MM
|
|
|
|
100644 X 2 MM
|
|
|
|
100644 X 3 MM
|
|
|
|
100644 X 0 MN
|
2005-06-11 13:50:51 +04:00
|
|
|
100644 X 0 NA
|
2005-05-27 01:38:19 +04:00
|
|
|
100644 X 1 ND
|
|
|
|
100644 X 2 ND
|
|
|
|
100644 X 0 NM
|
|
|
|
100644 X 0 NN
|
|
|
|
100644 X 0 SS
|
|
|
|
100644 X 1 TT
|
|
|
|
100644 X 2 TT
|
|
|
|
100644 X 3 TT
|
|
|
|
100644 X 2 Z/AA
|
|
|
|
100644 X 3 Z/AA
|
2005-06-11 13:50:51 +04:00
|
|
|
100644 X 0 Z/AN
|
2005-05-27 01:38:19 +04:00
|
|
|
100644 X 1 Z/DD
|
|
|
|
100644 X 1 Z/DM
|
|
|
|
100644 X 3 Z/DM
|
|
|
|
100644 X 1 Z/DN
|
|
|
|
100644 X 3 Z/DN
|
|
|
|
100644 X 1 Z/MD
|
|
|
|
100644 X 2 Z/MD
|
|
|
|
100644 X 1 Z/MM
|
|
|
|
100644 X 2 Z/MM
|
|
|
|
100644 X 3 Z/MM
|
|
|
|
100644 X 0 Z/MN
|
2005-06-11 13:50:51 +04:00
|
|
|
100644 X 0 Z/NA
|
2005-05-27 01:38:19 +04:00
|
|
|
100644 X 1 Z/ND
|
|
|
|
100644 X 2 Z/ND
|
|
|
|
100644 X 0 Z/NM
|
|
|
|
100644 X 0 Z/NN
|
2005-05-14 12:46:46 +04:00
|
|
|
EOF
|
|
|
|
|
2005-06-09 01:55:35 +04:00
|
|
|
check_result () {
|
2007-07-03 09:52:14 +04:00
|
|
|
git ls-files --stage | sed -e 's/ '"$_x40"' / X /' >current &&
|
2008-05-24 09:28:56 +04:00
|
|
|
test_cmp expected current
|
2005-06-09 01:55:35 +04:00
|
|
|
}
|
2005-06-08 13:08:54 +04:00
|
|
|
|
|
|
|
# This is done on an empty work directory, which is the normal
|
|
|
|
# merge person behaviour.
|
|
|
|
test_expect_success \
|
2007-07-03 09:52:14 +04:00
|
|
|
'3-way merge with git read-tree -m, empty cache' \
|
2005-06-08 13:08:54 +04:00
|
|
|
"rm -fr [NDMALTS][NDMALTSF] Z &&
|
|
|
|
rm .git/index &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
|
2005-06-09 01:55:35 +04:00
|
|
|
check_result"
|
2005-06-08 13:08:54 +04:00
|
|
|
|
|
|
|
# This starts out with the first head, which is the normal
|
|
|
|
# patch submitter behaviour.
|
2005-05-14 12:46:46 +04:00
|
|
|
test_expect_success \
|
2007-07-03 09:52:14 +04:00
|
|
|
'3-way merge with git read-tree -m, match H' \
|
2005-06-09 01:55:35 +04:00
|
|
|
"rm -fr [NDMALTS][NDMALTSF] Z &&
|
|
|
|
rm .git/index &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_succeed $tree_A &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git checkout-index -f -u -a &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
|
2005-06-09 01:55:35 +04:00
|
|
|
check_result"
|
|
|
|
|
|
|
|
: <<\END_OF_CASE_TABLE
|
|
|
|
|
|
|
|
We have so far tested only empty index and clean-and-matching-A index
|
|
|
|
case which are trivial. Make sure index requirements are also
|
2005-09-28 23:56:18 +04:00
|
|
|
checked.
|
2005-06-09 01:55:35 +04:00
|
|
|
|
2007-07-03 09:52:14 +04:00
|
|
|
"git read-tree -m O A B"
|
2005-06-09 01:55:35 +04:00
|
|
|
|
|
|
|
O A B result index requirements
|
|
|
|
-------------------------------------------------------------------
|
|
|
|
1 missing missing missing - must not exist.
|
|
|
|
------------------------------------------------------------------
|
2005-09-28 23:56:18 +04:00
|
|
|
2 missing missing exists take B* must match B, if exists.
|
2005-06-09 01:55:35 +04:00
|
|
|
------------------------------------------------------------------
|
2005-09-28 23:56:18 +04:00
|
|
|
3 missing exists missing take A* must match A, if exists.
|
2005-06-09 01:55:35 +04:00
|
|
|
------------------------------------------------------------------
|
|
|
|
4 missing exists A!=B no merge must match A and be
|
|
|
|
up-to-date, if exists.
|
|
|
|
------------------------------------------------------------------
|
2005-09-28 23:56:18 +04:00
|
|
|
5 missing exists A==B take A must match A, if exists.
|
2005-06-09 01:55:35 +04:00
|
|
|
------------------------------------------------------------------
|
2005-09-28 23:56:18 +04:00
|
|
|
6 exists missing missing remove must not exist.
|
2005-06-09 01:55:35 +04:00
|
|
|
------------------------------------------------------------------
|
|
|
|
7 exists missing O!=B no merge must not exist.
|
|
|
|
------------------------------------------------------------------
|
2005-09-28 23:56:18 +04:00
|
|
|
8 exists missing O==B remove must not exist.
|
2005-06-09 01:55:35 +04:00
|
|
|
------------------------------------------------------------------
|
|
|
|
9 exists O!=A missing no merge must match A and be
|
|
|
|
up-to-date, if exists.
|
|
|
|
------------------------------------------------------------------
|
2007-04-07 16:42:01 +04:00
|
|
|
10 exists O==A missing no merge must match A
|
2005-06-09 01:55:35 +04:00
|
|
|
------------------------------------------------------------------
|
|
|
|
11 exists O!=A O!=B no merge must match A and be
|
|
|
|
A!=B up-to-date, if exists.
|
|
|
|
------------------------------------------------------------------
|
|
|
|
12 exists O!=A O!=B take A must match A, if exists.
|
|
|
|
A==B
|
|
|
|
------------------------------------------------------------------
|
|
|
|
13 exists O!=A O==B take A must match A, if exists.
|
|
|
|
------------------------------------------------------------------
|
2005-09-28 23:56:18 +04:00
|
|
|
14 exists O==A O!=B take B if exists, must either (1)
|
2005-06-09 01:55:35 +04:00
|
|
|
match A and be up-to-date,
|
|
|
|
or (2) match B.
|
|
|
|
------------------------------------------------------------------
|
|
|
|
15 exists O==A O==B take B must match A if exists.
|
2005-09-06 23:53:56 +04:00
|
|
|
------------------------------------------------------------------
|
|
|
|
16 exists O==A O==B barf must match A if exists.
|
|
|
|
*multi* in one in another
|
2005-06-09 01:55:35 +04:00
|
|
|
-------------------------------------------------------------------
|
|
|
|
|
2005-09-28 23:56:18 +04:00
|
|
|
Note: we need to be careful in case 2 and 3. The tree A may contain
|
|
|
|
DF (file) when tree B require DF to be a directory by having DF/DF
|
|
|
|
(file).
|
2005-06-09 01:55:35 +04:00
|
|
|
|
|
|
|
END_OF_CASE_TABLE
|
|
|
|
|
2008-02-01 12:50:53 +03:00
|
|
|
test_expect_success '1 - must not have an entry not in A.' "
|
|
|
|
rm -f .git/index XX &&
|
2005-06-09 01:55:35 +04:00
|
|
|
echo XX >XX &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add XX &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_fail -m $tree_O $tree_A $tree_B
|
2008-02-01 12:50:53 +03:00
|
|
|
"
|
2005-06-09 01:55:35 +04:00
|
|
|
|
2005-06-11 13:50:51 +04:00
|
|
|
test_expect_success \
|
|
|
|
'2 - must match B in !O && !A && B case.' \
|
|
|
|
"rm -f .git/index NA &&
|
|
|
|
cp .orig-B/NA NA &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add NA &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_succeed -m $tree_O $tree_A $tree_B"
|
2005-06-11 13:50:51 +04:00
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'2 - matching B alone is OK in !O && !A && B case.' \
|
2005-06-09 01:55:35 +04:00
|
|
|
"rm -f .git/index NA &&
|
|
|
|
cp .orig-B/NA NA &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add NA &&
|
2005-06-11 13:50:51 +04:00
|
|
|
echo extra >>NA &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_succeed -m $tree_O $tree_A $tree_B"
|
2005-06-09 01:55:35 +04:00
|
|
|
|
|
|
|
test_expect_success \
|
2005-06-11 13:50:51 +04:00
|
|
|
'3 - must match A in !O && A && !B case.' \
|
2005-06-09 01:55:35 +04:00
|
|
|
"rm -f .git/index AN &&
|
|
|
|
cp .orig-A/AN AN &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add AN &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
|
2005-06-09 01:55:35 +04:00
|
|
|
check_result"
|
|
|
|
|
2005-06-11 13:50:51 +04:00
|
|
|
test_expect_success \
|
|
|
|
'3 - matching A alone is OK in !O && A && !B case.' \
|
2005-06-09 01:55:35 +04:00
|
|
|
"rm -f .git/index AN &&
|
|
|
|
cp .orig-A/AN AN &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add AN &&
|
2005-06-09 01:55:35 +04:00
|
|
|
echo extra >>AN &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_succeed -m $tree_O $tree_A $tree_B"
|
2005-06-09 01:55:35 +04:00
|
|
|
|
2008-02-01 12:50:53 +03:00
|
|
|
test_expect_success \
|
|
|
|
'3 (fail) - must match A in !O && A && !B case.' "
|
|
|
|
rm -f .git/index AN &&
|
2005-06-09 01:55:35 +04:00
|
|
|
cp .orig-A/AN AN &&
|
|
|
|
echo extra >>AN &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add AN &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_fail -m $tree_O $tree_A $tree_B
|
2008-02-01 12:50:53 +03:00
|
|
|
"
|
2005-06-09 01:55:35 +04:00
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'4 - must match and be up-to-date in !O && A && B && A!=B case.' \
|
|
|
|
"rm -f .git/index AA &&
|
|
|
|
cp .orig-A/AA AA &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add AA &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
|
2005-06-09 01:55:35 +04:00
|
|
|
check_result"
|
|
|
|
|
2008-02-01 12:50:53 +03:00
|
|
|
test_expect_success \
|
|
|
|
'4 (fail) - must match and be up-to-date in !O && A && B && A!=B case.' "
|
|
|
|
rm -f .git/index AA &&
|
2005-06-09 01:55:35 +04:00
|
|
|
cp .orig-A/AA AA &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add AA &&
|
2005-06-09 01:55:35 +04:00
|
|
|
echo extra >>AA &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_fail -m $tree_O $tree_A $tree_B
|
2008-02-01 12:50:53 +03:00
|
|
|
"
|
2005-06-09 01:55:35 +04:00
|
|
|
|
2008-02-01 12:50:53 +03:00
|
|
|
test_expect_success \
|
|
|
|
'4 (fail) - must match and be up-to-date in !O && A && B && A!=B case.' "
|
|
|
|
rm -f .git/index AA &&
|
2005-06-09 01:55:35 +04:00
|
|
|
cp .orig-A/AA AA &&
|
|
|
|
echo extra >>AA &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add AA &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_fail -m $tree_O $tree_A $tree_B
|
2008-02-01 12:50:53 +03:00
|
|
|
"
|
2005-06-09 01:55:35 +04:00
|
|
|
|
|
|
|
test_expect_success \
|
[PATCH] read-tree: fix too strong index requirement #5ALT
This fixes too strong index requirement 3-way merge enforces in
one case: the same file is added in both branches.
In this case, the original code insisted that if the index file
has that path, it must match our branch and be up-to-date.
However in this particular case, it only has to match it, and
can be dirty. We just need to make sure that we keep the
work-tree copy instead of checking out the merge result.
The resolution of such a path, however, cannot be left to
outside script, because we will not keep the original stage0
entries for unmerged paths when read-tree finishes, and at that
point, the knowledge of "if we resolve it to match the new file
added in both branches, the merge succeeds and the work tree
would not lose information, but we should _not_ update the work
tree from the resulting index file" is lost. For this reason,
the now code needs to resolve this case (#5ALT) internally.
This affects some existing tests in the test suite, but all in
positive ways. In t1000 (3-way test), this #5ALT case now gets
one stage0 entry, instead of an identical stage2 and stage3
entry pair, for such a path, and one test that checked for merge
failure (because the test assumed the "stricter-than-necessary"
behaviour) does not have to fail anymore. In t1005 (emu23
test), two tests that involves a case where the work tree
already had a change introduced in the upstream (aka "merged
head"), the merge succeeds instead of failing.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-11 05:37:47 +04:00
|
|
|
'5 - must match in !O && A && B && A==B case.' \
|
2005-06-09 01:55:35 +04:00
|
|
|
"rm -f .git/index LL &&
|
|
|
|
cp .orig-A/LL LL &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add LL &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
|
2005-06-09 01:55:35 +04:00
|
|
|
check_result"
|
|
|
|
|
[PATCH] read-tree: fix too strong index requirement #5ALT
This fixes too strong index requirement 3-way merge enforces in
one case: the same file is added in both branches.
In this case, the original code insisted that if the index file
has that path, it must match our branch and be up-to-date.
However in this particular case, it only has to match it, and
can be dirty. We just need to make sure that we keep the
work-tree copy instead of checking out the merge result.
The resolution of such a path, however, cannot be left to
outside script, because we will not keep the original stage0
entries for unmerged paths when read-tree finishes, and at that
point, the knowledge of "if we resolve it to match the new file
added in both branches, the merge succeeds and the work tree
would not lose information, but we should _not_ update the work
tree from the resulting index file" is lost. For this reason,
the now code needs to resolve this case (#5ALT) internally.
This affects some existing tests in the test suite, but all in
positive ways. In t1000 (3-way test), this #5ALT case now gets
one stage0 entry, instead of an identical stage2 and stage3
entry pair, for such a path, and one test that checked for merge
failure (because the test assumed the "stricter-than-necessary"
behaviour) does not have to fail anymore. In t1005 (emu23
test), two tests that involves a case where the work tree
already had a change introduced in the upstream (aka "merged
head"), the merge succeeds instead of failing.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-11 05:37:47 +04:00
|
|
|
test_expect_success \
|
|
|
|
'5 - must match in !O && A && B && A==B case.' \
|
2005-06-09 01:55:35 +04:00
|
|
|
"rm -f .git/index LL &&
|
|
|
|
cp .orig-A/LL LL &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add LL &&
|
2005-06-09 01:55:35 +04:00
|
|
|
echo extra >>LL &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
|
[PATCH] read-tree: fix too strong index requirement #5ALT
This fixes too strong index requirement 3-way merge enforces in
one case: the same file is added in both branches.
In this case, the original code insisted that if the index file
has that path, it must match our branch and be up-to-date.
However in this particular case, it only has to match it, and
can be dirty. We just need to make sure that we keep the
work-tree copy instead of checking out the merge result.
The resolution of such a path, however, cannot be left to
outside script, because we will not keep the original stage0
entries for unmerged paths when read-tree finishes, and at that
point, the knowledge of "if we resolve it to match the new file
added in both branches, the merge succeeds and the work tree
would not lose information, but we should _not_ update the work
tree from the resulting index file" is lost. For this reason,
the now code needs to resolve this case (#5ALT) internally.
This affects some existing tests in the test suite, but all in
positive ways. In t1000 (3-way test), this #5ALT case now gets
one stage0 entry, instead of an identical stage2 and stage3
entry pair, for such a path, and one test that checked for merge
failure (because the test assumed the "stricter-than-necessary"
behaviour) does not have to fail anymore. In t1005 (emu23
test), two tests that involves a case where the work tree
already had a change introduced in the upstream (aka "merged
head"), the merge succeeds instead of failing.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-11 05:37:47 +04:00
|
|
|
check_result"
|
2005-06-09 01:55:35 +04:00
|
|
|
|
2008-02-01 12:50:53 +03:00
|
|
|
test_expect_success \
|
|
|
|
'5 (fail) - must match A in !O && A && B && A==B case.' "
|
|
|
|
rm -f .git/index LL &&
|
2005-06-09 01:55:35 +04:00
|
|
|
cp .orig-A/LL LL &&
|
|
|
|
echo extra >>LL &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add LL &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_fail -m $tree_O $tree_A $tree_B
|
2008-02-01 12:50:53 +03:00
|
|
|
"
|
2005-06-09 01:55:35 +04:00
|
|
|
|
2008-02-01 12:50:53 +03:00
|
|
|
test_expect_success \
|
|
|
|
'6 - must not exist in O && !A && !B case' "
|
|
|
|
rm -f .git/index DD &&
|
2010-10-31 04:46:54 +03:00
|
|
|
echo DD >DD &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add DD &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_fail -m $tree_O $tree_A $tree_B
|
2008-02-01 12:50:53 +03:00
|
|
|
"
|
2005-06-09 01:55:35 +04:00
|
|
|
|
2008-02-01 12:50:53 +03:00
|
|
|
test_expect_success \
|
|
|
|
'7 - must not exist in O && !A && B && O!=B case' "
|
|
|
|
rm -f .git/index DM &&
|
2005-06-09 01:55:35 +04:00
|
|
|
cp .orig-B/DM DM &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add DM &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_fail -m $tree_O $tree_A $tree_B
|
2008-02-01 12:50:53 +03:00
|
|
|
"
|
2005-06-09 01:55:35 +04:00
|
|
|
|
2008-02-01 12:50:53 +03:00
|
|
|
test_expect_success \
|
|
|
|
'8 - must not exist in O && !A && B && O==B case' "
|
|
|
|
rm -f .git/index DN &&
|
2005-06-09 01:55:35 +04:00
|
|
|
cp .orig-B/DN DN &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add DN &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_fail -m $tree_O $tree_A $tree_B
|
2008-02-01 12:50:53 +03:00
|
|
|
"
|
2005-06-09 01:55:35 +04:00
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'9 - must match and be up-to-date in O && A && !B && O!=A case' \
|
|
|
|
"rm -f .git/index MD &&
|
|
|
|
cp .orig-A/MD MD &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add MD &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
|
2005-06-09 01:55:35 +04:00
|
|
|
check_result"
|
|
|
|
|
2008-02-01 12:50:53 +03:00
|
|
|
test_expect_success \
|
|
|
|
'9 (fail) - must match and be up-to-date in O && A && !B && O!=A case' "
|
|
|
|
rm -f .git/index MD &&
|
2005-06-09 01:55:35 +04:00
|
|
|
cp .orig-A/MD MD &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add MD &&
|
2005-06-09 01:55:35 +04:00
|
|
|
echo extra >>MD &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_fail -m $tree_O $tree_A $tree_B
|
2008-02-01 12:50:53 +03:00
|
|
|
"
|
2005-06-09 01:55:35 +04:00
|
|
|
|
2008-02-01 12:50:53 +03:00
|
|
|
test_expect_success \
|
|
|
|
'9 (fail) - must match and be up-to-date in O && A && !B && O!=A case' "
|
|
|
|
rm -f .git/index MD &&
|
2005-06-09 01:55:35 +04:00
|
|
|
cp .orig-A/MD MD &&
|
|
|
|
echo extra >>MD &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add MD &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_fail -m $tree_O $tree_A $tree_B
|
2008-02-01 12:50:53 +03:00
|
|
|
"
|
2005-06-09 01:55:35 +04:00
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'10 - must match and be up-to-date in O && A && !B && O==A case' \
|
|
|
|
"rm -f .git/index ND &&
|
|
|
|
cp .orig-A/ND ND &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add ND &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
|
2005-06-09 01:55:35 +04:00
|
|
|
check_result"
|
|
|
|
|
2008-02-01 12:50:53 +03:00
|
|
|
test_expect_success \
|
|
|
|
'10 (fail) - must match and be up-to-date in O && A && !B && O==A case' "
|
|
|
|
rm -f .git/index ND &&
|
2005-06-09 01:55:35 +04:00
|
|
|
cp .orig-A/ND ND &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add ND &&
|
2005-06-09 01:55:35 +04:00
|
|
|
echo extra >>ND &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_fail -m $tree_O $tree_A $tree_B
|
2008-02-01 12:50:53 +03:00
|
|
|
"
|
2005-06-09 01:55:35 +04:00
|
|
|
|
2008-02-01 12:50:53 +03:00
|
|
|
test_expect_success \
|
|
|
|
'10 (fail) - must match and be up-to-date in O && A && !B && O==A case' "
|
|
|
|
rm -f .git/index ND &&
|
2005-06-09 01:55:35 +04:00
|
|
|
cp .orig-A/ND ND &&
|
|
|
|
echo extra >>ND &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add ND &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_fail -m $tree_O $tree_A $tree_B
|
2008-02-01 12:50:53 +03:00
|
|
|
"
|
2005-06-09 01:55:35 +04:00
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'11 - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' \
|
|
|
|
"rm -f .git/index MM &&
|
|
|
|
cp .orig-A/MM MM &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add MM &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
|
2005-06-09 01:55:35 +04:00
|
|
|
check_result"
|
|
|
|
|
2008-02-01 12:50:53 +03:00
|
|
|
test_expect_success \
|
|
|
|
'11 (fail) - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' "
|
|
|
|
rm -f .git/index MM &&
|
2005-06-09 01:55:35 +04:00
|
|
|
cp .orig-A/MM MM &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add MM &&
|
2005-06-09 01:55:35 +04:00
|
|
|
echo extra >>MM &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_fail -m $tree_O $tree_A $tree_B
|
2008-02-01 12:50:53 +03:00
|
|
|
"
|
2005-06-09 01:55:35 +04:00
|
|
|
|
2008-02-01 12:50:53 +03:00
|
|
|
test_expect_success \
|
|
|
|
'11 (fail) - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' "
|
|
|
|
rm -f .git/index MM &&
|
2005-06-09 01:55:35 +04:00
|
|
|
cp .orig-A/MM MM &&
|
|
|
|
echo extra >>MM &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add MM &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_fail -m $tree_O $tree_A $tree_B
|
2008-02-01 12:50:53 +03:00
|
|
|
"
|
2005-06-09 01:55:35 +04:00
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'12 - must match A in O && A && B && O!=A && A==B case' \
|
|
|
|
"rm -f .git/index SS &&
|
|
|
|
cp .orig-A/SS SS &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add SS &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
|
2005-06-09 01:55:35 +04:00
|
|
|
check_result"
|
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'12 - must match A in O && A && B && O!=A && A==B case' \
|
|
|
|
"rm -f .git/index SS &&
|
|
|
|
cp .orig-A/SS SS &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add SS &&
|
2005-06-09 01:55:35 +04:00
|
|
|
echo extra >>SS &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
|
2005-06-09 01:55:35 +04:00
|
|
|
check_result"
|
|
|
|
|
2008-02-01 12:50:53 +03:00
|
|
|
test_expect_success \
|
|
|
|
'12 (fail) - must match A in O && A && B && O!=A && A==B case' "
|
|
|
|
rm -f .git/index SS &&
|
2005-06-09 01:55:35 +04:00
|
|
|
cp .orig-A/SS SS &&
|
|
|
|
echo extra >>SS &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add SS &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_fail -m $tree_O $tree_A $tree_B
|
2008-02-01 12:50:53 +03:00
|
|
|
"
|
2005-06-09 01:55:35 +04:00
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'13 - must match A in O && A && B && O!=A && O==B case' \
|
|
|
|
"rm -f .git/index MN &&
|
|
|
|
cp .orig-A/MN MN &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add MN &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
|
2005-06-09 01:55:35 +04:00
|
|
|
check_result"
|
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'13 - must match A in O && A && B && O!=A && O==B case' \
|
|
|
|
"rm -f .git/index MN &&
|
|
|
|
cp .orig-A/MN MN &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add MN &&
|
2005-06-09 01:55:35 +04:00
|
|
|
echo extra >>MN &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
|
2005-06-09 01:55:35 +04:00
|
|
|
check_result"
|
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'14 - must match and be up-to-date in O && A && B && O==A && O!=B case' \
|
|
|
|
"rm -f .git/index NM &&
|
|
|
|
cp .orig-A/NM NM &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add NM &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
|
2005-06-09 01:55:35 +04:00
|
|
|
check_result"
|
|
|
|
|
2005-06-11 13:53:57 +04:00
|
|
|
test_expect_success \
|
|
|
|
'14 - may match B in O && A && B && O==A && O!=B case' \
|
|
|
|
"rm -f .git/index NM &&
|
|
|
|
cp .orig-B/NM NM &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add NM &&
|
2005-06-11 13:53:57 +04:00
|
|
|
echo extra >>NM &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
|
2005-06-11 13:53:57 +04:00
|
|
|
check_result"
|
|
|
|
|
2008-02-01 12:50:53 +03:00
|
|
|
test_expect_success \
|
|
|
|
'14 (fail) - must match and be up-to-date in O && A && B && O==A && O!=B case' "
|
|
|
|
rm -f .git/index NM &&
|
2005-06-09 01:55:35 +04:00
|
|
|
cp .orig-A/NM NM &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add NM &&
|
2005-06-09 01:55:35 +04:00
|
|
|
echo extra >>NM &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_fail -m $tree_O $tree_A $tree_B
|
2008-02-01 12:50:53 +03:00
|
|
|
"
|
2005-06-09 01:55:35 +04:00
|
|
|
|
2008-02-01 12:50:53 +03:00
|
|
|
test_expect_success \
|
|
|
|
'14 (fail) - must match and be up-to-date in O && A && B && O==A && O!=B case' "
|
|
|
|
rm -f .git/index NM &&
|
2005-06-09 01:55:35 +04:00
|
|
|
cp .orig-A/NM NM &&
|
|
|
|
echo extra >>NM &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add NM &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_fail -m $tree_O $tree_A $tree_B
|
2008-02-01 12:50:53 +03:00
|
|
|
"
|
2005-06-09 01:55:35 +04:00
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'15 - must match A in O && A && B && O==A && O==B case' \
|
|
|
|
"rm -f .git/index NN &&
|
|
|
|
cp .orig-A/NN NN &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add NN &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
|
2005-06-09 01:55:35 +04:00
|
|
|
check_result"
|
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'15 - must match A in O && A && B && O==A && O==B case' \
|
|
|
|
"rm -f .git/index NN &&
|
|
|
|
cp .orig-A/NN NN &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add NN &&
|
2005-06-09 01:55:35 +04:00
|
|
|
echo extra >>NN &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
|
2005-06-09 01:55:35 +04:00
|
|
|
check_result"
|
|
|
|
|
2008-02-01 12:50:53 +03:00
|
|
|
test_expect_success \
|
|
|
|
'15 (fail) - must match A in O && A && B && O==A && O==B case' "
|
|
|
|
rm -f .git/index NN &&
|
2005-06-09 01:55:35 +04:00
|
|
|
cp .orig-A/NN NN &&
|
|
|
|
echo extra >>NN &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add NN &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_fail -m $tree_O $tree_A $tree_B
|
2008-02-01 12:50:53 +03:00
|
|
|
"
|
2005-05-14 12:46:46 +04:00
|
|
|
|
2005-09-06 23:53:56 +04:00
|
|
|
# #16
|
|
|
|
test_expect_success \
|
|
|
|
'16 - A matches in one and B matches in another.' \
|
|
|
|
'rm -f .git/index F16 &&
|
|
|
|
echo F16 >F16 &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index --add F16 &&
|
2014-04-28 16:57:31 +04:00
|
|
|
tree0=$(git write-tree) &&
|
2005-09-06 23:53:56 +04:00
|
|
|
echo E16 >F16 &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git update-index F16 &&
|
2014-04-28 16:57:31 +04:00
|
|
|
tree1=$(git write-tree) &&
|
2011-05-26 00:10:41 +04:00
|
|
|
read_tree_must_succeed -m $tree0 $tree1 $tree1 $tree0 &&
|
2007-07-03 09:52:14 +04:00
|
|
|
git ls-files --stage'
|
2005-09-06 23:53:56 +04:00
|
|
|
|
2005-05-14 12:46:46 +04:00
|
|
|
test_done
|