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>
Finn Arne Gangstad committed
Dec 18, 2007 at 20:50 UTC
20b178de7b20a0ebf02b8da3b4791c06fc8e3a63
1 file changed
+8
-1
merge-recursive.c
+8
-1
@@ -549,6 +549,10 @@ static void update_file_flags(const unsigned char *sha,
549
void *buf;
550
unsigned long size;
551
552
+ if (S_ISGITLINK(mode))
553
+ die("cannot read object %s '%s': It is a submodule!",
554
+ sha1_to_hex(sha), path);
555
+
556
buf = read_sha1_file(sha, &type, &size);
557
if (!buf)
558
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,
1467
mfi = merge_file(&o, &a, &b,
1468
branch1, branch2);
1469
1470
+ clean_merge = mfi.clean;
1471
if (mfi.clean)
1472
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));
1476
else {
1469
- clean_merge = 0;
1477
output(1, "CONFLICT (%s): Merge conflict in %s",
1478
reason, path);
1479