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>
This commit is contained in:
parent
5909651ea2
commit
20b178de7b
@ -549,6 +549,10 @@ static void update_file_flags(const unsigned char *sha,
|
|||||||
void *buf;
|
void *buf;
|
||||||
unsigned long size;
|
unsigned long size;
|
||||||
|
|
||||||
|
if (S_ISGITLINK(mode))
|
||||||
|
die("cannot read object %s '%s': It is a submodule!",
|
||||||
|
sha1_to_hex(sha), path);
|
||||||
|
|
||||||
buf = read_sha1_file(sha, &type, &size);
|
buf = read_sha1_file(sha, &type, &size);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
die("cannot read object %s '%s'", sha1_to_hex(sha), path);
|
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,
|
|||||||
mfi = merge_file(&o, &a, &b,
|
mfi = merge_file(&o, &a, &b,
|
||||||
branch1, branch2);
|
branch1, branch2);
|
||||||
|
|
||||||
|
clean_merge = mfi.clean;
|
||||||
if (mfi.clean)
|
if (mfi.clean)
|
||||||
update_file(1, mfi.sha, mfi.mode, path);
|
update_file(1, mfi.sha, mfi.mode, path);
|
||||||
|
else if (S_ISGITLINK(mfi.mode))
|
||||||
|
output(1, "CONFLICT (submodule): Merge conflict in %s "
|
||||||
|
"- needs %s", path, sha1_to_hex(b.sha1));
|
||||||
else {
|
else {
|
||||||
clean_merge = 0;
|
|
||||||
output(1, "CONFLICT (%s): Merge conflict in %s",
|
output(1, "CONFLICT (%s): Merge conflict in %s",
|
||||||
reason, path);
|
reason, path);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user