Skip to content

Commit 085d2ab

Browse files
committed
Merge branch 'sb/fix-fetching-moved-submodules'
The code to try seeing if a fetch is necessary in a submodule during a fetch with --recurse-submodules got confused when the path to the submodule was changed in the range of commits in the superproject, sometimes showing "(null)". This has been corrected. * sb/fix-fetching-moved-submodules: t5526: test recursive submodules when fetching moved submodules submodule: fix NULL correctness in renamed broken submodules
2 parents cf22247 + c3749f6 commit 085d2ab

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

submodule.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -740,12 +740,14 @@ static void collect_changed_submodules_cb(struct diff_queue_struct *q,
740740
else {
741741
name = default_name_or_path(p->two->path);
742742
/* make sure name does not collide with existing one */
743-
submodule = submodule_from_name(the_repository, commit_oid, name);
743+
if (name)
744+
submodule = submodule_from_name(the_repository,
745+
commit_oid, name);
744746
if (submodule) {
745747
warning("Submodule in commit %s at path: "
746748
"'%s' collides with a submodule named "
747749
"the same. Skipping it.",
748-
oid_to_hex(commit_oid), name);
750+
oid_to_hex(commit_oid), p->two->path);
749751
name = NULL;
750752
}
751753
}

t/t5526-fetch-submodules.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -574,11 +574,7 @@ test_expect_success "fetch new commits when submodule got renamed" '
574574
git clone . downstream_rename &&
575575
(
576576
cd downstream_rename &&
577-
git submodule update --init &&
578-
# NEEDSWORK: we omitted --recursive for the submodule update here since
579-
# that does not work. See test 7001 for mv "moving nested submodules"
580-
# for details. Once that is fixed we should add the --recursive option
581-
# here.
577+
git submodule update --init --recursive &&
582578
git checkout -b rename &&
583579
git mv submodule submodule_renamed &&
584580
(

0 commit comments

Comments
 (0)