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

[PATCH v2 1/6] merge,diff: remove the_repository check before prefetching blobs

From
Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>
Date
Feb 20, 2026, 01:59 UTC
Message-ID
<7155a0da6f8bcdac90cf1ed085622f2c8b68675e.1771552788.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.2048.v2.git.1771552788.gitgitgadget@gmail.com>
From: Elijah Newren <newren@gmail.com>

Prefetching of blobs from promisor remotes was added to diff in 7fbbcb21b162 (diff: batch fetching of missing blobs, 2019-04-05). In that commit,

  https://lore.kernel.org/git/20190405170934.20441-1-jonathantanmy@google.com/
was squashed into
  https://lore.kernel.org/git/44de02e584f449481e6fb00cf35d74adf0192e9d.1553895166.git.jonathantanmy@google.com/

without the extra explanation about the squashed changes being added to the commit message; in particular, this explanation from that first link is absent:

> Also, prefetch only if the repository being diffed is the_repository
> (because we do not support lazy fetching for any other repository
>  anyway).

Then, later, this checking was spread from diff.c to diffcore-rename.c and diffcore-break.c by 95acf11a3dc3 (diff: restrict when prefetching occurs, 2020-04-07) and then further split in d331dd3b0c82 (diffcore-rename: allow different missing_object_cb functions, 2021-06-22). I also copied the logic from prefetching blobs from diff.c to merge-ort.c in 2bff554b23e8 (merge-ort: add prefetching for content merges, 2021-06-22).

The reason for all these checks was noted above -- we only supported lazy fetching for the_repository. However, that changed with ef830cc43412 (promisor-remote: teach lazy-fetch in any repo, 2021-06-17), so these checks are now unnecessary. Remove them.

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 diff.c            | 2 +-
 diffcore-break.c  | 2 +-
 diffcore-rename.c | 4 ++--
 merge-ort.c       | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/diff.c b/diff.c
index 35b903a9a0..91d81f66ad 100644
--- a/diff.c
+++ b/diff.c
@@ -7176,7 +7176,7 @@ void diffcore_std(struct diff_options *options)
 	 * If no prefetching occurs, diffcore_rename() will prefetch if it
 	 * decides that it needs inexact rename detection.
 	 */
-	if (options->repo == the_repository && repo_has_promisor_remote(the_repository) &&
+	if (repo_has_promisor_remote(the_repository) &&
 	    (options->output_format & output_formats_to_prefetch ||
 	     options->pickaxe_opts & DIFF_PICKAXE_KINDS_MASK))
 		diff_queued_diff_prefetch(options->repo);
diff --git a/diffcore-break.c b/diffcore-break.c
index c4c2173f30..5ce227ba22 100644
--- a/diffcore-break.c
+++ b/diffcore-break.c
@@ -69,7 +69,7 @@ static int should_break(struct repository *r,
 	    oideq(&src->oid, &dst->oid))
 		return 0; /* they are the same */
 
-	if (r == the_repository && repo_has_promisor_remote(the_repository)) {
+	if (repo_has_promisor_remote(the_repository)) {
 		options.missing_object_cb = diff_queued_diff_prefetch;
 		options.missing_object_data = r;
 	}
diff --git a/diffcore-rename.c b/diffcore-rename.c
index d9476db35a..072752954e 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -987,7 +987,7 @@ static int find_basename_matches(struct diff_options *options,
 			strintmap_set(&dests, base, i);
 	}
 
-	if (options->repo == the_repository && repo_has_promisor_remote(the_repository)) {
+	if (repo_has_promisor_remote(the_repository)) {
 		dpf_options.missing_object_cb = basename_prefetch;
 		dpf_options.missing_object_data = &prefetch_options;
 	}
@@ -1574,7 +1574,7 @@ void diffcore_rename_extended(struct diff_options *options,
 
 	/* Finish setting up dpf_options */
 	prefetch_options.skip_unmodified = skip_unmodified;
-	if (options->repo == the_repository && repo_has_promisor_remote(the_repository)) {
+	if (repo_has_promisor_remote(the_repository)) {
 		dpf_options.missing_object_cb = inexact_prefetch;
 		dpf_options.missing_object_data = &prefetch_options;
 	}
diff --git a/merge-ort.c b/merge-ort.c
index 0a59d1e596..593e3a2087 100644
--- a/merge-ort.c
+++ b/merge-ort.c
@@ -4438,7 +4438,7 @@ static void prefetch_for_content_merges(struct merge_options *opt,
 	struct string_list_item *e;
 	struct oid_array to_fetch = OID_ARRAY_INIT;
 
-	if (opt->repo != the_repository || !repo_has_promisor_remote(the_repository))
+	if (!repo_has_promisor_remote(the_repository))
 		return;
 
 	for (e = &plist->items[plist->nr-1]; e >= plist->items; --e) {
-- 
gitgitgadget
Previous: Elijah Newren via GitGitGadgetNext: Patrick Steinhardt
Message 17 of 34 in “Avoid the_repository in merge-ort and replay”
  1. 0/5 Avoid the_repository in merge-ort and replayElijah Newren via GitGitGadget, Feb 18, 2026
  2. 1/5 merge-ort: pass repository to write_tree()Elijah Newren via GitGitGadget, Feb 18, 2026
  3. 2/5 merge-ort: replace the_repository with opt->repoElijah Newren via GitGitGadget, Feb 18, 2026
  4. 3/5 merge-ort: replace the_hash_algo with opt->repo->hash_algoElijah Newren via GitGitGadget, Feb 18, 2026
  5. Patrick SteinhardtFeb 19, 2026
  6. Elijah NewrenFeb 19, 2026
  7. 4/5 merge-ort: prevent the_repository from coming backElijah Newren via GitGitGadget, Feb 18, 2026
  8. Kristoffer HaugsbakkFeb 19, 2026
  9. Elijah NewrenFeb 19, 2026
  10. Patrick SteinhardtFeb 19, 2026
  11. Elijah NewrenFeb 19, 2026
  12. Junio C HamanoFeb 19, 2026
  13. Elijah NewrenFeb 19, 2026
  14. 5/5 replay: prevent the_repository from coming backElijah Newren via GitGitGadget, Feb 18, 2026
  15. Patrick SteinhardtFeb 19, 2026
  16. 0/6 Avoid the_repository in merge-ort and replayElijah Newren via GitGitGadget, Feb 20, 2026
  17. 1/6 merge,diff: remove the_repository check before prefetching blobsElijah Newren via GitGitGadget, Feb 20, 2026
  18. Patrick SteinhardtFeb 20, 2026
  19. Elijah NewrenFeb 20, 2026
  20. 2/6 merge-ort: pass repository to write_tree()Elijah Newren via GitGitGadget, Feb 20, 2026
  21. 3/6 merge-ort: replace the_repository with opt->repoElijah Newren via GitGitGadget, Feb 20, 2026
  22. 4/6 merge-ort: replace the_hash_algo with opt->repo->hash_algoElijah Newren via GitGitGadget, Feb 20, 2026
  23. 5/6 merge-ort: prevent the_repository from coming backElijah Newren via GitGitGadget, Feb 20, 2026
  24. 6/6 replay: prevent the_repository from coming backElijah Newren via GitGitGadget, Feb 20, 2026
  25. 0/6 Avoid the_repository in merge-ort and replayElijah Newren via GitGitGadget, Feb 21, 2026
  26. 1/6 merge,diff: remove the_repository check before prefetching blobsElijah Newren via GitGitGadget, Feb 21, 2026
  27. 2/6 merge-ort: pass repository to write_tree()Elijah Newren via GitGitGadget, Feb 21, 2026
  28. 3/6 merge-ort: replace the_repository with opt->repoElijah Newren via GitGitGadget, Feb 21, 2026
  29. 4/6 merge-ort: replace the_hash_algo with opt->repo->hash_algoElijah Newren via GitGitGadget, Feb 21, 2026
  30. 5/6 merge-ort: prevent the_repository from coming backElijah Newren via GitGitGadget, Feb 21, 2026
  31. Junio C HamanoFeb 22, 2026
  32. Elijah NewrenFeb 22, 2026
  33. Derrick StoleeFeb 23, 2026
  34. Patrick SteinhardtFeb 24, 2026

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.