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