Git 2.18
[git/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"
7cc8f971 6#include "pack-objects.h"
fff42755 7
fff42755
VM
8struct bitmap_disk_header {
9 char magic[4];
10 uint16_t version;
11 uint16_t options;
12 uint32_t entry_count;
13 unsigned char checksum[20];
14};
15
16static const char BITMAP_IDX_SIGNATURE[] = {'B', 'I', 'T', 'M'};
17
7cc8f971
VM
18#define NEEDS_BITMAP (1u<<22)
19
fff42755 20enum pack_bitmap_opts {
ae4f07fb
VM
21 BITMAP_OPT_FULL_DAG = 1,
22 BITMAP_OPT_HASH_CACHE = 4,
fff42755
VM
23};
24
7cc8f971
VM
25enum pack_bitmap_flags {
26 BITMAP_FLAG_REUSE = 0x1
27};
28
fff42755 29typedef int (*show_reachable_fn)(
20664967 30 const struct object_id *oid,
fff42755
VM
31 enum object_type type,
32 int flags,
33 uint32_t hash,
34 struct packed_git *found_pack,
35 off_t found_offset);
36
37int prepare_bitmap_git(void);
38void count_bitmap_commit_list(uint32_t *commits, uint32_t *trees, uint32_t *blobs, uint32_t *tags);
39void traverse_bitmap_commit_list(show_reachable_fn show_reachable);
40void test_bitmap_walk(struct rev_info *revs);
fff42755
VM
41int prepare_bitmap_walk(struct rev_info *revs);
42int reuse_partial_packfile_from_bitmap(struct packed_git **packfile, uint32_t *entries, off_t *up_to);
7cc8f971
VM
43int rebuild_existing_bitmaps(struct packing_data *mapping, khash_sha1 *reused_bitmaps, int show_progress);
44
45void bitmap_writer_show_progress(int show);
46void bitmap_writer_set_checksum(unsigned char *sha1);
06af3bba
NTND
47void bitmap_writer_build_type_index(struct packing_data *to_pack,
48 struct pack_idx_entry **index,
49 uint32_t index_nr);
7cc8f971
VM
50void bitmap_writer_reuse_bitmaps(struct packing_data *to_pack);
51void bitmap_writer_select_commits(struct commit **indexed_commits,
52 unsigned int indexed_commits_nr, int max_bitmaps);
53void bitmap_writer_build(struct packing_data *to_pack);
54void bitmap_writer_finish(struct pack_idx_entry **index,
55 uint32_t index_nr,
ae4f07fb
VM
56 const char *filename,
57 uint16_t options);
fff42755
VM
58
59#endif