7 #include "pack-objects.h"
8 #include "string-list.h"
14 static const char BITMAP_IDX_SIGNATURE
[] = {'B', 'I', 'T', 'M'};
16 struct bitmap_disk_header
{
17 char magic
[ARRAY_SIZE(BITMAP_IDX_SIGNATURE
)];
21 unsigned char checksum
[GIT_MAX_RAWSZ
];
24 #define NEEDS_BITMAP (1u<<22)
27 * The width in bytes of a single triplet in the lookup table
29 * (commit_pos, offset, xor_row)
31 * whose fields ar 32-, 64-, 32- bits wide, respectively.
33 #define BITMAP_LOOKUP_TABLE_TRIPLET_WIDTH (16)
35 enum pack_bitmap_opts
{
36 BITMAP_OPT_FULL_DAG
= 0x1,
37 BITMAP_OPT_HASH_CACHE
= 0x4,
38 BITMAP_OPT_LOOKUP_TABLE
= 0x10,
41 enum pack_bitmap_flags
{
42 BITMAP_FLAG_REUSE
= 0x1
45 typedef int (*show_reachable_fn
)(
46 const struct object_id
*oid
,
47 enum object_type type
,
50 struct packed_git
*found_pack
,
55 struct bitmap_index
*prepare_bitmap_git(struct repository
*r
);
56 struct bitmap_index
*prepare_midx_bitmap_git(struct multi_pack_index
*midx
);
57 void count_bitmap_commit_list(struct bitmap_index
*, uint32_t *commits
,
58 uint32_t *trees
, uint32_t *blobs
, uint32_t *tags
);
59 void traverse_bitmap_commit_list(struct bitmap_index
*,
60 struct rev_info
*revs
,
61 show_reachable_fn show_reachable
);
62 void test_bitmap_walk(struct rev_info
*revs
);
63 int test_bitmap_commits(struct repository
*r
);
64 int test_bitmap_hashes(struct repository
*r
);
65 struct bitmap_index
*prepare_bitmap_walk(struct rev_info
*revs
,
66 int filter_provided_objects
);
67 uint32_t midx_preferred_pack(struct bitmap_index
*bitmap_git
);
68 int reuse_partial_packfile_from_bitmap(struct bitmap_index
*,
69 struct packed_git
**packfile
,
71 struct bitmap
**reuse_out
);
72 int rebuild_existing_bitmaps(struct bitmap_index
*, struct packing_data
*mapping
,
73 kh_oid_map_t
*reused_bitmaps
, int show_progress
);
74 void free_bitmap_index(struct bitmap_index
*);
75 int bitmap_walk_contains(struct bitmap_index
*,
76 struct bitmap
*bitmap
, const struct object_id
*oid
);
79 * After a traversal has been performed by prepare_bitmap_walk(), this can be
80 * queried to see if a particular object was reachable from any of the
81 * objects flagged as UNINTERESTING.
83 int bitmap_has_oid_in_uninteresting(struct bitmap_index
*, const struct object_id
*oid
);
85 off_t
get_disk_usage_from_bitmap(struct bitmap_index
*, struct rev_info
*);
87 void bitmap_writer_show_progress(int show
);
88 void bitmap_writer_set_checksum(const unsigned char *sha1
);
89 void bitmap_writer_build_type_index(struct packing_data
*to_pack
,
90 struct pack_idx_entry
**index
,
92 uint32_t *create_bitmap_mapping(struct bitmap_index
*bitmap_git
,
93 struct packing_data
*mapping
);
94 int rebuild_bitmap(const uint32_t *reposition
,
95 struct ewah_bitmap
*source
,
97 struct ewah_bitmap
*bitmap_for_commit(struct bitmap_index
*bitmap_git
,
98 struct commit
*commit
);
99 void bitmap_writer_select_commits(struct commit
**indexed_commits
,
100 unsigned int indexed_commits_nr
, int max_bitmaps
);
101 int bitmap_writer_build(struct packing_data
*to_pack
);
102 void bitmap_writer_finish(struct pack_idx_entry
**index
,
104 const char *filename
,
106 char *midx_bitmap_filename(struct multi_pack_index
*midx
);
107 char *pack_bitmap_filename(struct packed_git
*p
);
109 int bitmap_is_midx(struct bitmap_index
*bitmap_git
);
111 const struct string_list
*bitmap_preferred_tips(struct repository
*r
);
112 int bitmap_is_preferred_refname(struct repository
*r
, const char *refname
);
114 int verify_bitmap_files(struct repository
*r
);