OSDN Git Service

pack-bitmap: convert traverse_bitmap_commit_list to object_id
authorbrian m. carlson <sandals@crustytoothpaste.net>
Sun, 15 Oct 2017 22:07:00 +0000 (22:07 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 16 Oct 2017 02:05:51 +0000 (11:05 +0900)
Convert traverse_bitmap_commit_list and the callbacks it takes to use a
pointer to struct object_id.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/pack-objects.c
builtin/rev-list.c
pack-bitmap.c
pack-bitmap.h

index 6e77dfd..d2d97cc 100644 (file)
@@ -1097,20 +1097,20 @@ static int add_object_entry(const unsigned char *sha1, enum object_type type,
        return 1;
 }
 
-static int add_object_entry_from_bitmap(const unsigned char *sha1,
+static int add_object_entry_from_bitmap(const struct object_id *oid,
                                        enum object_type type,
                                        int flags, uint32_t name_hash,
                                        struct packed_git *pack, off_t offset)
 {
        uint32_t index_pos;
 
-       if (have_duplicate_entry(sha1, 0, &index_pos))
+       if (have_duplicate_entry(oid->hash, 0, &index_pos))
                return 0;
 
-       if (!want_object_in_pack(sha1, 0, &pack, &offset))
+       if (!want_object_in_pack(oid->hash, 0, &pack, &offset))
                return 0;
 
-       create_object_entry(sha1, type, name_hash, 0, 0, index_pos, pack, offset);
+       create_object_entry(oid->hash, type, name_hash, 0, 0, index_pos, pack, offset);
 
        display_progress(progress_state, nr_result);
        return 1;
index c1c74d4..9bf8d59 100644 (file)
@@ -258,14 +258,14 @@ static int show_bisect_vars(struct rev_list_info *info, int reaches, int all)
 }
 
 static int show_object_fast(
-       const unsigned char *sha1,
+       const struct object_id *oid,
        enum object_type type,
        int exclude,
        uint32_t name_hash,
        struct packed_git *found_pack,
        off_t found_offset)
 {
-       fprintf(stdout, "%s\n", sha1_to_hex(sha1));
+       fprintf(stdout, "%s\n", oid_to_hex(oid));
        return 1;
 }
 
index 42e3d5f..9270983 100644 (file)
@@ -587,7 +587,7 @@ static void show_extended_objects(struct bitmap *objects,
                        continue;
 
                obj = eindex->objects[i];
-               show_reach(obj->oid.hash, obj->type, 0, eindex->hashes[i], NULL, 0);
+               show_reach(&obj->oid, obj->type, 0, eindex->hashes[i], NULL, 0);
        }
 }
 
@@ -612,7 +612,7 @@ static void show_objects_for_type(
                eword_t word = objects->words[i] & filter;
 
                for (offset = 0; offset < BITS_IN_EWORD; ++offset) {
-                       const unsigned char *sha1;
+                       struct object_id oid;
                        struct revindex_entry *entry;
                        uint32_t hash = 0;
 
@@ -625,12 +625,12 @@ static void show_objects_for_type(
                                continue;
 
                        entry = &bitmap_git.pack->revindex[pos + offset];
-                       sha1 = nth_packed_object_sha1(bitmap_git.pack, entry->nr);
+                       nth_packed_object_oid(&oid, bitmap_git.pack, entry->nr);
 
                        if (bitmap_git.hashes)
                                hash = get_be32(bitmap_git.hashes + entry->nr);
 
-                       show_reach(sha1, object_type, 0, hash, bitmap_git.pack, entry->offset);
+                       show_reach(&oid, object_type, 0, hash, bitmap_git.pack, entry->offset);
                }
 
                pos += BITS_IN_EWORD;
index 0adcef7..3742a00 100644 (file)
@@ -27,7 +27,7 @@ enum pack_bitmap_flags {
 };
 
 typedef int (*show_reachable_fn)(
-       const unsigned char *sha1,
+       const struct object_id *oid,
        enum object_type type,
        int flags,
        uint32_t hash,