From 386cb77210cdb09cd808698d21d0e796cd77f26f Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 27 Feb 2009 23:43:37 -0800 Subject: Consolidate ignore_packed logic more This refactors three loops that check if a given packfile is on the ignore_packed list into a function is_kept_pack(). The function returns false for a pack on the list, and true for a pack not on the list, because this list is solely used by "git repack" to pass list of packfiles that do not have corresponding .keep files, i.e. a packfile not on the list is "kept". Signed-off-by: Junio C Hamano --- builtin-pack-objects.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'builtin-pack-objects.c') diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c index fb5e14d56..7e7719b83 100644 --- a/builtin-pack-objects.c +++ b/builtin-pack-objects.c @@ -1915,11 +1915,7 @@ static void add_objects_in_unpacked_packs(struct rev_info *revs) const unsigned char *sha1; struct object *o; - for (i = 0; i < revs->num_ignore_packed; i++) { - if (matches_pack_name(p, revs->ignore_packed[i])) - break; - } - if (revs->num_ignore_packed <= i) + if (is_kept_pack(p, revs)) continue; if (open_pack_index(p)) die("cannot open pack index"); @@ -1955,11 +1951,7 @@ static void loosen_unused_packed_objects(struct rev_info *revs) const unsigned char *sha1; for (p = packed_git; p; p = p->next) { - for (i = 0; i < revs->num_ignore_packed; i++) { - if (matches_pack_name(p, revs->ignore_packed[i])) - break; - } - if (revs->num_ignore_packed <= i) + if (is_kept_pack(p, revs)) continue; if (open_pack_index(p)) -- cgit v1.2.1