Skip to content

Commit 7061f5c

Browse files
iabervonJunio C Hamano
authored andcommitted
[PATCH] Finish documenting trivial merge rules
Fix missing symbol explanations, a few incorrect cases, and add two-way merge rules. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent c3bc895 commit 7061f5c

File tree

1 file changed

+39
-10
lines changed

1 file changed

+39
-10
lines changed

Documentation/technical/trivial-merge.txt

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ This replaces the index with a different tree, keeping the stat info
1010
for entries that don't change, and allowing -u to make the minimum
1111
required changes to the working tree to have it match.
1212

13+
Entries marked '+' have stat information. Spaces marked '*' don't
14+
affect the result.
15+
1316
index tree result
1417
-----------------------
1518
* (empty) (empty)
@@ -20,7 +23,30 @@ required changes to the working tree to have it match.
2023
Two-way merge
2124
-------------
2225

26+
It is permitted for the index to lack an entry; this does not prevent
27+
any case from applying.
28+
29+
If the index exists, it is an error for it not to match either the old
30+
or the result.
31+
32+
If multiple cases apply, the one used is listed first.
33+
34+
A result which changes the index is an error if the index is not empty
35+
and not up-to-date.
36+
37+
Entries marked '+' have stat information. Spaces marked '*' don't
38+
affect the result.
2339

40+
case index old new result
41+
-------------------------------------
42+
0/2 (empty) * (empty) (empty)
43+
1/3 (empty) * new new
44+
4/5 index+ (empty) (empty) index+
45+
6/7 index+ (empty) index index+
46+
10 index+ index (empty) (empty)
47+
14/15 index+ old old index+
48+
18/19 index+ old index index+
49+
20 index+ index new new
2450

2551
Three-way merge
2652
---------------
@@ -44,30 +70,28 @@ up-to-date.
4470
*empty* means that the tree must not have a directory-file conflict
4571
with the entry.
4672

47-
For multiple ancestors or remotes, a '+' means that this case applies
48-
even if only one ancestor or remote fits; normally, all of the
49-
ancestors or remotes must be the same.
73+
For multiple ancestors, a '+' means that this case applies even if
74+
only one ancestor or remote fits; a '^' means all of the ancestors
75+
must be the same.
5076

5177
case ancest head remote result
5278
----------------------------------------
5379
1 (empty)+ (empty) (empty) (empty)
5480
2ALT (empty)+ *empty* remote remote
55-
2ALT (empty)+ *empty* remote remote
5681
2 (empty)^ (empty) remote no merge
5782
3ALT (empty)+ head *empty* head
5883
3 (empty)^ head (empty) no merge
5984
4 (empty)^ head remote no merge
6085
5ALT * head head head
61-
6 ancest^ (empty) (empty) no merge
62-
8ALT ancest (empty) ancest (empty)
86+
6 ancest+ (empty) (empty) no merge
87+
8 ancest^ (empty) ancest no merge
6388
7 ancest+ (empty) remote no merge
89+
10 ancest^ ancest (empty) no merge
6490
9 ancest+ head (empty) no merge
65-
10ALT ancest ancest (empty) (empty)
66-
11 ancest+ head remote no merge
6791
16 anc1/anc2 anc1 anc2 no merge
6892
13 ancest+ head ancest head
6993
14 ancest+ ancest remote remote
70-
14ALT ancest+ ancest remote remote
94+
11 ancest+ head remote no merge
7195

7296
Only #2ALT and #3ALT use *empty*, because these are the only cases
7397
where there can be conflicts that didn't exist before. Note that we
@@ -89,4 +113,9 @@ right. This is a case of a reverted patch (in some direction, maybe
89113
multiple times), and the right answer depends on looking at crossings
90114
of history or common ancestors of the ancestors.
91115

92-
The status as of Sep 5 is that multiple remotes are not supported
116+
Note that, between #6, #7, #9, and #11, all cases not otherwise
117+
covered are handled in this table.
118+
119+
For #8 and #10, there is alternative behavior, not currently
120+
implemented, where the result is (empty). As currently implemented,
121+
the automatic merge will generally give this effect.

0 commit comments

Comments
 (0)