Allow the test suite to pass in a directory whose name contains spaces
[gitweb.git] / pack-bitmap.c
index d92394692eec56860d0c836f31019f0e03527008..294cfa43a4458c6758b8ac1529e48374931b66c8 100644 (file)
@@ -33,9 +33,6 @@ static struct bitmap_index {
        /* Packfile to which this bitmap index belongs to */
        struct packed_git *pack;
 
-       /* reverse index for the packfile */
-       struct pack_revindex *reverse_index;
-
        /*
         * Mark the first `reuse_objects` in the packfile as reused:
         * they will be sent as-is without using them for repacking
@@ -269,7 +266,7 @@ static int open_pack_bitmap_1(struct packed_git *packfile)
                return -1;
 
        idx_name = pack_bitmap_filename(packfile);
-       fd = git_open_noatime(idx_name);
+       fd = git_open(idx_name);
        free(idx_name);
 
        if (fd < 0)
@@ -308,7 +305,7 @@ static int load_pack_bitmap(void)
 
        bitmap_git.bitmaps = kh_init_sha1();
        bitmap_git.ext_index.positions = kh_init_sha1_pos();
-       bitmap_git.reverse_index = revindex_for_pack(bitmap_git.pack);
+       load_pack_revindex(bitmap_git.pack);
 
        if (!(bitmap_git.commits = read_bitmap_1(&bitmap_git)) ||
                !(bitmap_git.trees = read_bitmap_1(&bitmap_git)) ||
@@ -380,7 +377,7 @@ static inline int bitmap_position_packfile(const unsigned char *sha1)
        if (!offset)
                return -1;
 
-       return find_revindex_position(bitmap_git.reverse_index, offset);
+       return find_revindex_position(bitmap_git.pack, offset);
 }
 
 static int bitmap_position(const unsigned char *sha1)
@@ -626,11 +623,11 @@ static void show_objects_for_type(
                        if (pos + offset < bitmap_git.reuse_objects)
                                continue;
 
-                       entry = &bitmap_git.reverse_index->revindex[pos + offset];
+                       entry = &bitmap_git.pack->revindex[pos + offset];
                        sha1 = nth_packed_object_sha1(bitmap_git.pack, entry->nr);
 
                        if (bitmap_git.hashes)
-                               hash = ntohl(bitmap_git.hashes[entry->nr]);
+                               hash = get_be32(bitmap_git.hashes + entry->nr);
 
                        show_reach(sha1, object_type, 0, hash, bitmap_git.pack, entry->offset);
                }
@@ -800,7 +797,7 @@ int reuse_partial_packfile_from_bitmap(struct packed_git **packfile,
                return -1;
 
        bitmap_git.reuse_objects = *entries = reuse_objects;
-       *up_to = bitmap_git.reverse_index->revindex[reuse_objects].offset;
+       *up_to = bitmap_git.pack->revindex[reuse_objects].offset;
        *packfile = bitmap_git.pack;
 
        return 0;
@@ -1033,7 +1030,7 @@ int rebuild_existing_bitmaps(struct packing_data *mapping,
                struct revindex_entry *entry;
                struct object_entry *oe;
 
-               entry = &bitmap_git.reverse_index->revindex[i];
+               entry = &bitmap_git.pack->revindex[i];
                sha1 = nth_packed_object_sha1(bitmap_git.pack, entry->nr);
                oe = packlist_find(mapping, sha1, NULL);