]> git.ipfire.org Git - thirdparty/git.git/blame - pack-bitmap.h
reftable: fix resource leak blocksource.c
[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"
3f267a11 8#include "string-list.h"
fff42755 9
ef3ca954 10struct commit;
7c141127 11struct repository;
ef3ca954 12struct rev_info;
6663ae0a 13struct list_objects_filter_options;
ef3ca954 14
af26e2a9
DL
15static const char BITMAP_IDX_SIGNATURE[] = {'B', 'I', 'T', 'M'};
16
fff42755 17struct bitmap_disk_header {
af26e2a9 18 char magic[ARRAY_SIZE(BITMAP_IDX_SIGNATURE)];
fff42755
VM
19 uint16_t version;
20 uint16_t options;
21 uint32_t entry_count;
0f4d6cad 22 unsigned char checksum[GIT_MAX_RAWSZ];
fff42755
VM
23};
24
7cc8f971
VM
25#define NEEDS_BITMAP (1u<<22)
26
fff42755 27enum pack_bitmap_opts {
ae4f07fb
VM
28 BITMAP_OPT_FULL_DAG = 1,
29 BITMAP_OPT_HASH_CACHE = 4,
fff42755
VM
30};
31
7cc8f971
VM
32enum pack_bitmap_flags {
33 BITMAP_FLAG_REUSE = 0x1
34};
35
fff42755 36typedef int (*show_reachable_fn)(
20664967 37 const struct object_id *oid,
fff42755
VM
38 enum object_type type,
39 int flags,
40 uint32_t hash,
41 struct packed_git *found_pack,
42 off_t found_offset);
43
3ae5fa07
JT
44struct bitmap_index;
45
7c141127 46struct bitmap_index *prepare_bitmap_git(struct repository *r);
bfbb60d3 47struct bitmap_index *prepare_midx_bitmap_git(struct multi_pack_index *midx);
3ae5fa07
JT
48void count_bitmap_commit_list(struct bitmap_index *, uint32_t *commits,
49 uint32_t *trees, uint32_t *blobs, uint32_t *tags);
50void traverse_bitmap_commit_list(struct bitmap_index *,
4eb707eb 51 struct rev_info *revs,
3ae5fa07 52 show_reachable_fn show_reachable);
fff42755 53void test_bitmap_walk(struct rev_info *revs);
dff5e49e 54int test_bitmap_commits(struct repository *r);
a05f02b1 55int test_bitmap_hashes(struct repository *r);
6663ae0a 56struct bitmap_index *prepare_bitmap_walk(struct rev_info *revs,
9cf68b27
PS
57 struct list_objects_filter_options *filter,
58 int filter_provided_objects);
6d08b9d4 59uint32_t midx_preferred_pack(struct bitmap_index *bitmap_git);
3ae5fa07
JT
60int reuse_partial_packfile_from_bitmap(struct bitmap_index *,
61 struct packed_git **packfile,
bb514de3
JK
62 uint32_t *entries,
63 struct bitmap **reuse_out);
3ae5fa07 64int rebuild_existing_bitmaps(struct bitmap_index *, struct packing_data *mapping,
d2bc62b1 65 kh_oid_map_t *reused_bitmaps, int show_progress);
f3c23db2 66void free_bitmap_index(struct bitmap_index *);
40d18ff8
JK
67int bitmap_walk_contains(struct bitmap_index *,
68 struct bitmap *bitmap, const struct object_id *oid);
7cc8f971 69
30cdc33f 70/*
5476fb07 71 * After a traversal has been performed by prepare_bitmap_walk(), this can be
30cdc33f
JK
72 * queried to see if a particular object was reachable from any of the
73 * objects flagged as UNINTERESTING.
74 */
3c771448 75int bitmap_has_oid_in_uninteresting(struct bitmap_index *, const struct object_id *oid);
30cdc33f 76
16950f83
JK
77off_t get_disk_usage_from_bitmap(struct bitmap_index *, struct rev_info *);
78
7cc8f971
VM
79void bitmap_writer_show_progress(int show);
80void bitmap_writer_set_checksum(unsigned char *sha1);
06af3bba
NTND
81void bitmap_writer_build_type_index(struct packing_data *to_pack,
82 struct pack_idx_entry **index,
83 uint32_t index_nr);
449fa5ee
JK
84uint32_t *create_bitmap_mapping(struct bitmap_index *bitmap_git,
85 struct packing_data *mapping);
86int rebuild_bitmap(const uint32_t *reposition,
87 struct ewah_bitmap *source,
88 struct bitmap *dest);
98c31f36
TB
89struct ewah_bitmap *bitmap_for_commit(struct bitmap_index *bitmap_git,
90 struct commit *commit);
7cc8f971
VM
91void bitmap_writer_select_commits(struct commit **indexed_commits,
92 unsigned int indexed_commits_nr, int max_bitmaps);
3ba3d062 93int bitmap_writer_build(struct packing_data *to_pack);
7cc8f971
VM
94void bitmap_writer_finish(struct pack_idx_entry **index,
95 uint32_t index_nr,
ae4f07fb
VM
96 const char *filename,
97 uint16_t options);
0f533c72
TB
98char *midx_bitmap_filename(struct multi_pack_index *midx);
99char *pack_bitmap_filename(struct packed_git *p);
100
101int bitmap_is_midx(struct bitmap_index *bitmap_git);
fff42755 102
3f267a11 103const struct string_list *bitmap_preferred_tips(struct repository *r);
711260fd 104int bitmap_is_preferred_refname(struct repository *r, const char *refname);
3f267a11 105
fff42755 106#endif