@matheusbsbs / matheus-bagliano / commits / eaa8677039
Fork 0

Simplify index access condition in count-objects, pack-redundant

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>

Shawn O. Pearce committed May 30, 2007 at 02:12 UTC eaa867703927c1f383637979d16c40d996cea240
2 files changed +2 -2
builtin-count-objects.c
+1 -1
@@ -111,7 +111,7 @@ int cmd_count_objects(int ac, const char **av, const char *prefix)
111 for (p = packed_git; p; p = p->next) {
112 if (!p->pack_local)
113 continue;
114 - if (!p->index_data && open_pack_index(p))
114 + if (open_pack_index(p))
115 continue;
116 packed += p->num_objects;
117 num_pack++;
pack-redundant.c
+1 -1
@@ -550,7 +550,7 @@ static struct pack_list * add_pack(struct packed_git *p)
550 l.pack = p;
551 llist_init(&l.all_objects);
552
553 - if (!p->index_data && open_pack_index(p))
553 + if (open_pack_index(p))
554 return NULL;
555
556 base = p->index_data;