Skip to content

Commit 20b178d

Browse files
Finn Arne Gangstadgitster
authored andcommitted
Improved submodule merge support
When merging conflicting submodule changes from a supermodule, generate a conflict message saying what went wrong. Also leave the tree in a state where git status shows the conflict, and git submodule status gives the user enough information to do the merge manally. Previously this would just fail. Signed-off-by: Finn Arne Gangstad <finnag@pvv.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 5909651 commit 20b178d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

merge-recursive.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,10 @@ static void update_file_flags(const unsigned char *sha,
549549
void *buf;
550550
unsigned long size;
551551

552+
if (S_ISGITLINK(mode))
553+
die("cannot read object %s '%s': It is a submodule!",
554+
sha1_to_hex(sha), path);
555+
552556
buf = read_sha1_file(sha, &type, &size);
553557
if (!buf)
554558
die("cannot read object %s '%s'", sha1_to_hex(sha), path);
@@ -1463,10 +1467,13 @@ static int process_entry(const char *path, struct stage_data *entry,
14631467
mfi = merge_file(&o, &a, &b,
14641468
branch1, branch2);
14651469

1470+
clean_merge = mfi.clean;
14661471
if (mfi.clean)
14671472
update_file(1, mfi.sha, mfi.mode, path);
1473+
else if (S_ISGITLINK(mfi.mode))
1474+
output(1, "CONFLICT (submodule): Merge conflict in %s "
1475+
"- needs %s", path, sha1_to_hex(b.sha1));
14681476
else {
1469-
clean_merge = 0;
14701477
output(1, "CONFLICT (%s): Merge conflict in %s",
14711478
reason, path);
14721479

0 commit comments

Comments
 (0)