git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Use correct default remote for fetching in submodule.
@ 2023-02-13 13:14 Mara
  2023-02-13 13:45 ` Eric Sunshine
  0 siblings, 1 reply; 2+ messages in thread
From: Mara @ 2023-02-13 13:14 UTC (permalink / raw)
  To: git

"git submodule update" first tries a regular "git fetch"
to fetch the commit, but when that doesn't retrieve the commit
it wants, it tries "git fetch <remote> <commit>".
For <remote>, it used the wrong default remote: the default
remote of the outer repository, rather than the default remote
of the submodule.

Signed-off-by: Mara Bos <mara@marabos.nl>
---
 builtin/submodule--helper.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 4c173d8b37..50b96e0b9d 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -2225,7 +2225,10 @@ static int fetch_in_submodule(const char *module_path, int depth, int quiet,
 		strvec_pushf(&cp.args, "--depth=%d", depth);
 	if (oid) {
 		char *hex = oid_to_hex(oid);
-		char *remote = get_default_remote();
+		char *remote;
+		int code = get_default_remote_submodule(module_path, &remote);
+		if (code)
+			return code;

 		strvec_pushl(&cp.args, remote, hex, NULL);
 		free(remote);
--
2.39.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-13 13:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-13 13:14 [PATCH] Use correct default remote for fetching in submodule Mara
2023-02-13 13:45 ` Eric Sunshine

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).