Skip to content

Commit 2811649

Browse files
ttaylorrgitster
authored andcommitted
packfile.c: remove unnecessary prepare_packed_git() call
In 454ea2e (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 660c889 (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 454ea2e, since get_all_packs() itself calls prepare_packed_git(). But the translation in 454ea2e 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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e106040 commit 2811649

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

packfile.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2220,7 +2220,6 @@ int for_each_packed_object(struct repository *repo, each_packed_object_fn cb,
22202220
int r = 0;
22212221
int pack_errors = 0;
22222222

2223-
prepare_packed_git(repo);
22242223
for (p = get_all_packs(repo); p; p = p->next) {
22252224
if ((flags & FOR_EACH_OBJECT_LOCAL_ONLY) && !p->pack_local)
22262225
continue;

0 commit comments

Comments
 (0)