rev-list: disable bitmaps when "-n" is used with listing objects
[gitweb.git] / pack-bitmap.c
index e5abb8a0460d49b603e29d1afe02db89fede8d24..aee7acf39204178f605221e49c66d302ca5329aa 100644 (file)
@@ -422,19 +422,15 @@ static int ext_index_add_object(struct object *object, const char *name)
        return bitmap_pos + bitmap_git.pack->num_objects;
 }
 
-static void show_object(struct object *object, const struct name_path *path,
-                       const char *last, void *data)
+static void show_object(struct object *object, const char *name, void *data)
 {
        struct bitmap *base = data;
        int bitmap_pos;
 
        bitmap_pos = bitmap_position(object->sha1);
 
-       if (bitmap_pos < 0) {
-               char *name = path_name(path, last);
+       if (bitmap_pos < 0)
                bitmap_pos = ext_index_add_object(object, name);
-               free(name);
-       }
 
        bitmap_set(base, bitmap_pos);
 }
@@ -622,7 +618,7 @@ static void show_objects_for_type(
        while (i < objects->word_alloc && ewah_iterator_next(&filter, &it)) {
                eword_t word = objects->words[i] & filter;
 
-               for (offset = 0; offset < BITS_IN_WORD; ++offset) {
+               for (offset = 0; offset < BITS_IN_EWORD; ++offset) {
                        const unsigned char *sha1;
                        struct revindex_entry *entry;
                        uint32_t hash = 0;
@@ -644,7 +640,7 @@ static void show_objects_for_type(
                        show_reach(sha1, object_type, 0, hash, bitmap_git.pack, entry->offset);
                }
 
-               pos += BITS_IN_WORD;
+               pos += BITS_IN_EWORD;
                i++;
        }
 }
@@ -776,7 +772,7 @@ int reuse_partial_packfile_from_bitmap(struct packed_git **packfile,
                        break;
                }
 
-               reuse_objects += BITS_IN_WORD;
+               reuse_objects += BITS_IN_EWORD;
        }
 
 #ifdef GIT_BITMAP_DEBUG
@@ -902,9 +898,8 @@ struct bitmap_test_data {
        size_t seen;
 };
 
-static void test_show_object(struct object *object,
-                            const struct name_path *path,
-                            const char *last, void *data)
+static void test_show_object(struct object *object, const char *name,
+                            void *data)
 {
        struct bitmap_test_data *tdata = data;
        int bitmap_pos;
@@ -985,7 +980,7 @@ void test_bitmap_walk(struct rev_info *revs)
        else
                fprintf(stderr, "Mismatch!\n");
 
-       free(result);
+       bitmap_free(result);
 }
 
 static int rebuild_bitmap(uint32_t *reposition,
@@ -1001,7 +996,7 @@ static int rebuild_bitmap(uint32_t *reposition,
        while (ewah_iterator_next(&word, &it)) {
                uint32_t offset, bit_pos;
 
-               for (offset = 0; offset < BITS_IN_WORD; ++offset) {
+               for (offset = 0; offset < BITS_IN_EWORD; ++offset) {
                        if ((word >> offset) == 0)
                                break;
 
@@ -1014,7 +1009,7 @@ static int rebuild_bitmap(uint32_t *reposition,
                                return -1;
                }
 
-               pos += BITS_IN_WORD;
+               pos += BITS_IN_EWORD;
        }
        return 0;
 }