mirror of
https://github.com/git/git.git
synced 2024-11-27 20:14:30 +08:00
af26e2a9d2
When we ran `make hdr-check` with the following patch diff --git a/Makefile b/Makefile index f879697ea3..d8df4e316b 100644 --- a/Makefile +++ b/Makefile @@ -2773,7 +2773,7 @@ CHK_HDRS = $(filter-out $(EXCEPT_HDRS),$(patsubst ./%,%,$(LIB_H))) HCO = $(patsubst %.h,%.hco,$(CHK_HDRS)) $(HCO): %.hco: %.h FORCE - $(QUIET_HDR)$(CC) -include git-compat-util.h -I. -o /dev/null -c -xc $< + $(QUIET_HDR)$(CC) -include git-compat-util.h -I. -o /dev/null -c -xc $(ALL_CFLAGS) $< .PHONY: hdr-check $(HCO) hdr-check: $(HCO) and with `DEVELOPER=1`, we got the following warning on Arch Linux: pack-bitmap.h:20:19: error: ‘BITMAP_IDX_SIGNATURE’ defined but not used [-Werror=unused-const-variable=] 20 | static const char BITMAP_IDX_SIGNATURE[] = {'B', 'I', 'T', 'M'}; | ^~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors "Use" the BITMAP_IDX_SIGNATURE variable by making the size of bitmap_disk_header.magic equal to the size of BITMAP_IDX_SIGNATURE, thereby eliminating the magic number (4). An alternative was to simply add MAYBE_UNUSED, however that does not eliminate the magic number. Another alternative was to change the definition to extern const char BITMAP_IDX_SIGNATURE[4]; However, this design was also not chosen as the static definition allows us to keep the declaration together for readability along with removing the magic number. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
79 lines
2.3 KiB
C
79 lines
2.3 KiB
C
#ifndef PACK_BITMAP_H
|
|
#define PACK_BITMAP_H
|
|
|
|
#include "ewah/ewok.h"
|
|
#include "khash.h"
|
|
#include "pack-objects.h"
|
|
|
|
struct commit;
|
|
struct repository;
|
|
struct rev_info;
|
|
|
|
static const char BITMAP_IDX_SIGNATURE[] = {'B', 'I', 'T', 'M'};
|
|
|
|
struct bitmap_disk_header {
|
|
char magic[ARRAY_SIZE(BITMAP_IDX_SIGNATURE)];
|
|
uint16_t version;
|
|
uint16_t options;
|
|
uint32_t entry_count;
|
|
unsigned char checksum[GIT_MAX_RAWSZ];
|
|
};
|
|
|
|
#define NEEDS_BITMAP (1u<<22)
|
|
|
|
enum pack_bitmap_opts {
|
|
BITMAP_OPT_FULL_DAG = 1,
|
|
BITMAP_OPT_HASH_CACHE = 4,
|
|
};
|
|
|
|
enum pack_bitmap_flags {
|
|
BITMAP_FLAG_REUSE = 0x1
|
|
};
|
|
|
|
typedef int (*show_reachable_fn)(
|
|
const struct object_id *oid,
|
|
enum object_type type,
|
|
int flags,
|
|
uint32_t hash,
|
|
struct packed_git *found_pack,
|
|
off_t found_offset);
|
|
|
|
struct bitmap_index;
|
|
|
|
struct bitmap_index *prepare_bitmap_git(struct repository *r);
|
|
void count_bitmap_commit_list(struct bitmap_index *, uint32_t *commits,
|
|
uint32_t *trees, uint32_t *blobs, uint32_t *tags);
|
|
void traverse_bitmap_commit_list(struct bitmap_index *,
|
|
show_reachable_fn show_reachable);
|
|
void test_bitmap_walk(struct rev_info *revs);
|
|
struct bitmap_index *prepare_bitmap_walk(struct rev_info *revs);
|
|
int reuse_partial_packfile_from_bitmap(struct bitmap_index *,
|
|
struct packed_git **packfile,
|
|
uint32_t *entries, off_t *up_to);
|
|
int rebuild_existing_bitmaps(struct bitmap_index *, struct packing_data *mapping,
|
|
kh_oid_map_t *reused_bitmaps, int show_progress);
|
|
void free_bitmap_index(struct bitmap_index *);
|
|
|
|
/*
|
|
* After a traversal has been performed by prepare_bitmap_walk(), this can be
|
|
* queried to see if a particular object was reachable from any of the
|
|
* objects flagged as UNINTERESTING.
|
|
*/
|
|
int bitmap_has_oid_in_uninteresting(struct bitmap_index *, const struct object_id *oid);
|
|
|
|
void bitmap_writer_show_progress(int show);
|
|
void bitmap_writer_set_checksum(unsigned char *sha1);
|
|
void bitmap_writer_build_type_index(struct packing_data *to_pack,
|
|
struct pack_idx_entry **index,
|
|
uint32_t index_nr);
|
|
void bitmap_writer_reuse_bitmaps(struct packing_data *to_pack);
|
|
void bitmap_writer_select_commits(struct commit **indexed_commits,
|
|
unsigned int indexed_commits_nr, int max_bitmaps);
|
|
void bitmap_writer_build(struct packing_data *to_pack);
|
|
void bitmap_writer_finish(struct pack_idx_entry **index,
|
|
uint32_t index_nr,
|
|
const char *filename,
|
|
uint16_t options);
|
|
|
|
#endif
|