summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2024-12-03 15:44:04 +0100
committerJunio C Hamano <gitster@pobox.com>2024-12-04 00:21:56 +0100
commit281164995159ed641f5e76f40515baf0b5811943 (patch)
treeb22d4652653b26f62964528b21a47d1f14dae8a8
parentmidx: add repository to `multi_pack_index` struct (diff)
downloadgit-281164995159ed641f5e76f40515baf0b5811943.tar.xz
git-281164995159ed641f5e76f40515baf0b5811943.zip
packfile.c: remove unnecessary prepare_packed_git() call
In 454ea2e4d7 (treewide: use get_all_packs, 2018-08-20) we converted existing calls to both: - get_packed_git(), as well as - the_repository->objects->packed_git , to instead use the new get_all_packs() function. In the instance that this commit addresses, there was a preceding call to prepare_packed_git(), which dates all the way back to 660c889e46 (sha1_file: add for_each iterators for loose and packed objects, 2014-10-15) when its caller (for_each_packed_object()) was first introduced. This call could have been removed in 454ea2e4d7, since get_all_packs() itself calls prepare_packed_git(). But the translation in 454ea2e4d7 was (to the best of my knowledge) a find-and-replace rather than inspecting each individual caller. Having an extra prepare_packed_git() call here is harmless, since it will notice that we have already set the 'packed_git_initialized' field and the call will be a noop. So we're only talking about a few dozen CPU cycles to set up and tear down the stack frame. But having a lone prepare_packed_git() call immediately before a call to get_all_packs() confused me, so let's remove it as redundant to avoid more confusion in the future. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--packfile.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/packfile.c b/packfile.c
index 2e0e28c7de..9c4bd81a8c 100644
--- a/packfile.c
+++ b/packfile.c
@@ -2220,7 +2220,6 @@ int for_each_packed_object(struct repository *repo, each_packed_object_fn cb,
int r = 0;
int pack_errors = 0;
- prepare_packed_git(repo);
for (p = get_all_packs(repo); p; p = p->next) {
if ((flags & FOR_EACH_OBJECT_LOCAL_ONLY) && !p->pack_local)
continue;