Skip to content

Commit

Permalink
Simplify index access condition in count-objects, pack-redundant
Browse files Browse the repository at this point in the history
My earlier lazy index opening patch changed this condition to check
index_data and call open_pack_index if it was NULL. In truth we only
care about num_objects.  Since open_pack_index does no harm if the
index is already open, and all indexes are likely to be closed in
this application, the "performance optimization" of inlining the
index_data check here was wrong.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Shawn O. Pearce authored and Junio C Hamano committed May 30, 2007
1 parent 7ff895c commit eaa8677
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion builtin-count-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ int cmd_count_objects(int ac, const char **av, const char *prefix)
for (p = packed_git; p; p = p->next) {
if (!p->pack_local)
continue;
if (!p->index_data && open_pack_index(p))
if (open_pack_index(p))
continue;
packed += p->num_objects;
num_pack++;
Expand Down
2 changes: 1 addition & 1 deletion pack-redundant.c
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ static struct pack_list * add_pack(struct packed_git *p)
l.pack = p;
llist_init(&l.all_objects);

if (!p->index_data && open_pack_index(p))
if (open_pack_index(p))
return NULL;

base = p->index_data;
Expand Down

0 comments on commit eaa8677

Please sign in to comment.