path: root/merge-recursive.c
diff options
authorJunio C Hamano <>2007-12-10 19:22:05 (GMT)
committerJunio C Hamano <>2007-12-11 08:40:56 (GMT)
commitff72af00f86cbbaaab57c886c70f9799715ca02f (patch)
tree301c0913f7fc3b8199e7751524305d9e1b04cca7 /merge-recursive.c
parent591aa2536fdbc4090ba8d4ca512d4ee7df4bf05d (diff)
Support a merge with conflicting gitlink change
merge-recursive did not support merging trees that have conflicting changes in submodules they contain, and died. Support it exactly the same way as how it handles conflicting symbolic link changes --- mark it as a conflict, take the tentative result from the current side, and letting the caller resolve the conflict, without dying in merge_file() function. Also reword the error message issued when merge_file() has to die because it sees a tree entry of type it does not support yet. [jc: fixed up initial draft by Finn Arne Gangstad] Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'merge-recursive.c')
1 files changed, 6 insertions, 4 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index 9a1e2f2..2a58dad 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1046,14 +1046,16 @@ static struct merge_file_info merge_file(struct diff_filespec *o,
result.clean = (merge_status == 0);
- } else {
- if (!(S_ISLNK(a->mode) || S_ISLNK(b->mode)))
- die("cannot merge modes?");
+ } else if (S_ISGITLINK(a->mode)) {
+ result.clean = 0;
+ hashcpy(result.sha, a->sha1);
+ } else if (S_ISLNK(a->mode)) {
hashcpy(result.sha, a->sha1);
if (!sha_eq(a->sha1, b->sha1))
result.clean = 0;
+ } else {
+ die("unsupported object type in the tree");