Skip to content

Commit f70a50f

Browse files
committed
Merge branch 'sb/test-cherry-pick-submodule-getting-in-a-way'
The three-way merge performed by "git cherry-pick" was confused when a new submodule was added in the meantime, which has been fixed (or "papered over"). * sb/test-cherry-pick-submodule-getting-in-a-way: merge-recursive: handle addition of submodule on our side of history t/3512: demonstrate unrelated submodule/file conflict as cherry-pick failure
2 parents c5e7630 + c641ca6 commit f70a50f

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

merge-recursive.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1901,8 +1901,9 @@ static int process_entry(struct merge_options *o,
19011901
oid = b_oid;
19021902
conf = _("directory/file");
19031903
}
1904-
if (dir_in_way(path, !o->call_depth,
1905-
S_ISGITLINK(a_mode))) {
1904+
if (dir_in_way(path,
1905+
!o->call_depth && !S_ISGITLINK(a_mode),
1906+
0)) {
19061907
char *new_path = unique_path(o, path, add_branch);
19071908
clean_merge = 0;
19081909
output(o, 1, _("CONFLICT (%s): There is a directory with name %s in %s. "

t/t3512-cherry-pick-submodule.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,40 @@ KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR=1
1010
KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES=1
1111
test_submodule_switch "git cherry-pick"
1212

13+
test_expect_success 'unrelated submodule/file conflict is ignored' '
14+
test_create_repo sub &&
15+
16+
touch sub/file &&
17+
git -C sub add file &&
18+
git -C sub commit -m "add a file in a submodule" &&
19+
20+
test_create_repo a_repo &&
21+
(
22+
cd a_repo &&
23+
>a_file &&
24+
git add a_file &&
25+
git commit -m "add a file" &&
26+
27+
git branch test &&
28+
git checkout test &&
29+
30+
mkdir sub &&
31+
>sub/content &&
32+
git add sub/content &&
33+
git commit -m "add a regular folder with name sub" &&
34+
35+
echo "123" >a_file &&
36+
git add a_file &&
37+
git commit -m "modify a file" &&
38+
39+
git checkout master &&
40+
41+
git submodule add ../sub sub &&
42+
git submodule update sub &&
43+
git commit -m "add a submodule info folder with name sub" &&
44+
45+
git cherry-pick test
46+
)
47+
'
48+
1349
test_done

0 commit comments

Comments
 (0)