]> git.ipfire.org Git - thirdparty/git.git/commitdiff
pack-bitmap: simplify bitmap_has_oid_in_uninteresting()
authorJeff King <peff@peff.net>
Wed, 18 Dec 2019 11:25:41 +0000 (12:25 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 23 Jan 2020 18:51:50 +0000 (10:51 -0800)
Let's refactor bitmap_has_oid_in_uninteresting() using
bitmap_walk_contains().

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
pack-bitmap.c

index b6f5fa1fc6f0d5a900a3fa9c668fb0a6cb6cdf18..41330a461ecd9fa11142f4d1ba89570defd89bb9 100644 (file)
@@ -1132,16 +1132,6 @@ void free_bitmap_index(struct bitmap_index *b)
 int bitmap_has_oid_in_uninteresting(struct bitmap_index *bitmap_git,
                                    const struct object_id *oid)
 {
-       int pos;
-
-       if (!bitmap_git)
-               return 0; /* no bitmap loaded */
-       if (!bitmap_git->haves)
-               return 0; /* walk had no "haves" */
-
-       pos = bitmap_position(bitmap_git, oid);
-       if (pos < 0)
-               return 0;
-
-       return bitmap_get(bitmap_git->haves, pos);
+       return bitmap_git &&
+               bitmap_walk_contains(bitmap_git, bitmap_git->haves, oid);
 }