]> git.ipfire.org Git - thirdparty/git.git/blame - pack-bitmap.h
The sixth batch for 2.26
[thirdparty/git.git] / pack-bitmap.h
CommitLineData
fff42755
VM
1#ifndef PACK_BITMAP_H
2#define PACK_BITMAP_H
3
4#include "ewah/ewok.h"
5#include "khash.h"
40d18ff8 6#include "pack.h"
7cc8f971 7#include "pack-objects.h"
fff42755 8
ef3ca954 9struct commit;
7c141127 10struct repository;
ef3ca954
EN
11struct rev_info;
12
af26e2a9
DL
13static const char BITMAP_IDX_SIGNATURE[] = {'B', 'I', 'T', 'M'};
14
fff42755 15struct bitmap_disk_header {
af26e2a9 16 char magic[ARRAY_SIZE(BITMAP_IDX_SIGNATURE)];
fff42755
VM
17 uint16_t version;
18 uint16_t options;
19 uint32_t entry_count;
0f4d6cad 20 unsigned char checksum[GIT_MAX_RAWSZ];
fff42755
VM
21};
22
7cc8f971
VM
23#define NEEDS_BITMAP (1u<<22)
24
fff42755 25enum pack_bitmap_opts {
ae4f07fb
VM
26 BITMAP_OPT_FULL_DAG = 1,
27 BITMAP_OPT_HASH_CACHE = 4,
fff42755
VM
28};
29
7cc8f971
VM
30enum pack_bitmap_flags {
31 BITMAP_FLAG_REUSE = 0x1
32};
33
fff42755 34typedef int (*show_reachable_fn)(
20664967 35 const struct object_id *oid,
fff42755
VM
36 enum object_type type,
37 int flags,
38 uint32_t hash,
39 struct packed_git *found_pack,
40 off_t found_offset);
41
3ae5fa07
JT
42struct bitmap_index;
43
7c141127 44struct bitmap_index *prepare_bitmap_git(struct repository *r);
3ae5fa07
JT
45void count_bitmap_commit_list(struct bitmap_index *, uint32_t *commits,
46 uint32_t *trees, uint32_t *blobs, uint32_t *tags);
47void traverse_bitmap_commit_list(struct bitmap_index *,
48 show_reachable_fn show_reachable);
fff42755 49void test_bitmap_walk(struct rev_info *revs);
3ae5fa07
JT
50struct bitmap_index *prepare_bitmap_walk(struct rev_info *revs);
51int reuse_partial_packfile_from_bitmap(struct bitmap_index *,
52 struct packed_git **packfile,
bb514de3
JK
53 uint32_t *entries,
54 struct bitmap **reuse_out);
3ae5fa07 55int rebuild_existing_bitmaps(struct bitmap_index *, struct packing_data *mapping,
d2bc62b1 56 kh_oid_map_t *reused_bitmaps, int show_progress);
f3c23db2 57void free_bitmap_index(struct bitmap_index *);
40d18ff8
JK
58int bitmap_walk_contains(struct bitmap_index *,
59 struct bitmap *bitmap, const struct object_id *oid);
7cc8f971 60
30cdc33f 61/*
5476fb07 62 * After a traversal has been performed by prepare_bitmap_walk(), this can be
30cdc33f
JK
63 * queried to see if a particular object was reachable from any of the
64 * objects flagged as UNINTERESTING.
65 */
3c771448 66int bitmap_has_oid_in_uninteresting(struct bitmap_index *, const struct object_id *oid);
30cdc33f 67
7cc8f971
VM
68void bitmap_writer_show_progress(int show);
69void bitmap_writer_set_checksum(unsigned char *sha1);
06af3bba
NTND
70void bitmap_writer_build_type_index(struct packing_data *to_pack,
71 struct pack_idx_entry **index,
72 uint32_t index_nr);
7cc8f971
VM
73void bitmap_writer_reuse_bitmaps(struct packing_data *to_pack);
74void bitmap_writer_select_commits(struct commit **indexed_commits,
75 unsigned int indexed_commits_nr, int max_bitmaps);
76void bitmap_writer_build(struct packing_data *to_pack);
77void bitmap_writer_finish(struct pack_idx_entry **index,
78 uint32_t index_nr,
ae4f07fb
VM
79 const char *filename,
80 uint16_t options);
fff42755
VM
81
82#endif