Skip to content

Commit 0c44c94

Browse files
committed
merge-recursive: do not die on a conflicting submodule
We cannot represent the 3-way conflicted state in the work tree for these entries, but it is normal not to have commit objects for them in our repository. Just update the index and the life will be good. Signed-off-by: Junio C Hamano <[email protected]>
1 parent d212ca1 commit 0c44c94

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

merge-recursive.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,8 +520,12 @@ static void update_file_flags(struct merge_options *o,
520520
unsigned long size;
521521

522522
if (S_ISGITLINK(mode))
523-
die("cannot read object %s '%s': It is a submodule!",
524-
sha1_to_hex(sha), path);
523+
/*
524+
* We may later decide to recursively descend into
525+
* the submodule directory and update its index
526+
* and/or work tree, but we do not do that now.
527+
*/
528+
goto update_index;
525529

526530
buf = read_sha1_file(sha, &type, &size);
527531
if (!buf)

t/t7405-submodule-merge.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ test_expect_success setup '
5454
git merge -s ours a
5555
'
5656

57-
test_expect_failure 'merging with modify/modify conflict' '
57+
test_expect_success 'merging with modify/modify conflict' '
5858
5959
git checkout -b test1 a &&
6060
test_must_fail git merge b &&
6161
test -f .git/MERGE_MSG &&
62-
git diff
63-
62+
git diff &&
63+
test -n "$(git ls-files -u)"
6464
'
6565

6666
test_expect_success 'merging with a modify/modify conflict between merge bases' '

0 commit comments

Comments
 (0)