summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2021-09-21 16:51:08 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-09-23 00:15:11 (GMT)
commitb578cf61a825d1961474cec360408e8045b7e70b (patch)
tree07b3741d8adae1f32218b9bc51bba4fd7cb3d351
parent20140255c5d6ca924486c023e0ad8518ea02bfc2 (diff)
downloadgit-b578cf61a825d1961474cec360408e8045b7e70b.zip
git-b578cf61a825d1961474cec360408e8045b7e70b.tar.gz
git-b578cf61a825d1961474cec360408e8045b7e70b.tar.bz2
object-file: only register submodule ODB if needed
In a35e03dee0 ("submodule: lazily add submodule ODBs as alternates", 2021-09-08), Git was taught to add all known submodule ODBs as alternates when attempting to read an object that doesn't exist, as a fallback for when a submodule object is read as if it were in the_repository. However, this behavior wasn't restricted to happen only when reading from the_repository. Fix this. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--object-file.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/object-file.c b/object-file.c
index c1f7ece..3f469b8 100644
--- a/object-file.c
+++ b/object-file.c
@@ -1614,7 +1614,8 @@ static int do_oid_object_info_extended(struct repository *r,
break;
}
- if (register_all_submodule_odb_as_alternates())
+ if (r == the_repository &&
+ register_all_submodule_odb_as_alternates())
/* We added some alternates; retry */
continue;