git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git treeless-clone + wait + pull → problem, again pull → OK

From
Jeff King <peff@peff.net>
Date
Jul 22, 2025, 09:24 UTC
Message-ID
<20250722092403.GA889790@coredump.intra.peff.net>
In-Reply-To
<20250722091749.GA864077@coredump.intra.peff.net>
On Tue, Jul 22, 2025 at 05:17:49AM -0400, Jeff King wrote:
Show 7 quoted lines
> Whether or not fetch should avoid kicking off that big string of
> fetches, I don't know. Passing --no-recurse-submodules obviously dulls
> the pain. Perhaps the default behavior ought to be different in a
> tree-less repo. Or maybe those tree diffs should be done with
> lazy-fetching turned off (there is no point in recursing for a version
> of a submodule whose parent tree we don't even have!). But I think
> that's all orthogonal to the race.

In an ideal world, I'd imagine that something like this would make sense:

diff --git a/submodule.c b/submodule.c
index f8373a9ea7..e064fefd9a 100644
--- a/submodule.c
+++ b/submodule.c
@@ -1851,7 +1851,12 @@ int fetch_submodules(struct repository *r,
 	strvec_push(&spf.args, "--recurse-submodules-default");
 	/* default value, "--submodule-prefix" and its value are added later */
 
-	calculate_changed_submodule_paths(r, &spf.changed_submodule_names);
+	{
+		int save = fetch_if_missing;
+		fetch_if_missing = 0;
+		calculate_changed_submodule_paths(r, &spf.changed_submodule_names);
+		fetch_if_missing = save;
+	}
 	string_list_sort(&spf.changed_submodule_names);
 	run_processes_parallel(&opts);
 

But it doesn't work, because all of the diff code under the hood in the
calculate_changed_submodule_paths() call is not prepared for trees to be
missing. So you just get:

  fatal: unable to read tree (3a112b53a40e2d1240b2a4d01d5e616e0f4f09fd)

or similar. We'd need to teach the diff code some permissive mode where
it quietly ignores trees we don't have locally.

-Peff
Previous: Jeff King
Message 3 of 3 in “git treeless-clone + wait + pull → problem, again pull → OK”
  1. Дилян ПалаузовJul 1, 2025
  2. Jeff KingJul 22, 2025
  3. Jeff KingJul 22, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.