Skip to content

Commit 84325f0

Browse files
newrengitster
authored andcommitted
merge,diff: remove the_repository check before prefetching blobs
Prefetching of blobs from promisor remotes was added to diff in 7fbbcb2 (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 95acf11 (diff: restrict when prefetching occurs, 2020-04-07) and then further split in d331dd3 (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 2bff554 (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 ef830cc (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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 73fd778 commit 84325f0

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7176,7 +7176,7 @@ void diffcore_std(struct diff_options *options)
71767176
* If no prefetching occurs, diffcore_rename() will prefetch if it
71777177
* decides that it needs inexact rename detection.
71787178
*/
7179-
if (options->repo == the_repository && repo_has_promisor_remote(the_repository) &&
7179+
if (repo_has_promisor_remote(options->repo) &&
71807180
(options->output_format & output_formats_to_prefetch ||
71817181
options->pickaxe_opts & DIFF_PICKAXE_KINDS_MASK))
71827182
diff_queued_diff_prefetch(options->repo);

diffcore-break.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static int should_break(struct repository *r,
6969
oideq(&src->oid, &dst->oid))
7070
return 0; /* they are the same */
7171

72-
if (r == the_repository && repo_has_promisor_remote(the_repository)) {
72+
if (repo_has_promisor_remote(r)) {
7373
options.missing_object_cb = diff_queued_diff_prefetch;
7474
options.missing_object_data = r;
7575
}

diffcore-rename.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,7 @@ static int find_basename_matches(struct diff_options *options,
987987
strintmap_set(&dests, base, i);
988988
}
989989

990-
if (options->repo == the_repository && repo_has_promisor_remote(the_repository)) {
990+
if (repo_has_promisor_remote(options->repo)) {
991991
dpf_options.missing_object_cb = basename_prefetch;
992992
dpf_options.missing_object_data = &prefetch_options;
993993
}
@@ -1574,7 +1574,7 @@ void diffcore_rename_extended(struct diff_options *options,
15741574

15751575
/* Finish setting up dpf_options */
15761576
prefetch_options.skip_unmodified = skip_unmodified;
1577-
if (options->repo == the_repository && repo_has_promisor_remote(the_repository)) {
1577+
if (repo_has_promisor_remote(options->repo)) {
15781578
dpf_options.missing_object_cb = inexact_prefetch;
15791579
dpf_options.missing_object_data = &prefetch_options;
15801580
}

merge-ort.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4438,7 +4438,7 @@ static void prefetch_for_content_merges(struct merge_options *opt,
44384438
struct string_list_item *e;
44394439
struct oid_array to_fetch = OID_ARRAY_INIT;
44404440

4441-
if (opt->repo != the_repository || !repo_has_promisor_remote(the_repository))
4441+
if (!repo_has_promisor_remote(opt->repo))
44424442
return;
44434443

44444444
for (e = &plist->items[plist->nr-1]; e >= plist->items; --e) {

0 commit comments

Comments
 (0)