]>
Commit | Line | Data |
---|---|---|
08fd81c9 DS |
1 | #ifndef COMMIT_GRAPH_H |
2 | #define COMMIT_GRAPH_H | |
3 | ||
2a2e32bd | 4 | #include "git-compat-util.h" |
283e68c7 | 5 | #include "repository.h" |
d88b14b3 | 6 | #include "string-list.h" |
ef3ca954 | 7 | #include "cache.h" |
2a2e32bd | 8 | |
e5c5ca27 JT |
9 | struct commit; |
10 | ||
2a2e32bd DS |
11 | char *get_commit_graph_filename(const char *obj_dir); |
12 | ||
177722b3 DS |
13 | /* |
14 | * Given a commit struct, try to fill the commit struct info, including: | |
15 | * 1. tree object | |
16 | * 2. date | |
17 | * 3. parents. | |
18 | * | |
19 | * Returns 1 if and only if the commit was found in the packed graph. | |
20 | * | |
21 | * See parse_commit_buffer() for the fallback after this call. | |
22 | */ | |
dade47c0 | 23 | int parse_commit_in_graph(struct repository *r, struct commit *item); |
177722b3 | 24 | |
e2838d85 DS |
25 | /* |
26 | * It is possible that we loaded commit contents from the commit buffer, | |
27 | * but we also want to ensure the commit-graph content is correctly | |
28 | * checked and filled. Fill the graph_pos and generation members of | |
29 | * the given commit. | |
30 | */ | |
dade47c0 | 31 | void load_commit_graph_info(struct repository *r, struct commit *item); |
e2838d85 | 32 | |
dade47c0 JT |
33 | struct tree *get_commit_tree_in_graph(struct repository *r, |
34 | const struct commit *c); | |
7b8a21db | 35 | |
2a2e32bd DS |
36 | struct commit_graph { |
37 | int graph_fd; | |
38 | ||
39 | const unsigned char *data; | |
40 | size_t data_len; | |
41 | ||
42 | unsigned char hash_len; | |
43 | unsigned char num_chunks; | |
44 | uint32_t num_commits; | |
45 | struct object_id oid; | |
46 | ||
47 | const uint32_t *chunk_oid_fanout; | |
48 | const unsigned char *chunk_oid_lookup; | |
49 | const unsigned char *chunk_commit_data; | |
50 | const unsigned char *chunk_large_edges; | |
51 | }; | |
52 | ||
53 | struct commit_graph *load_commit_graph_one(const char *graph_file); | |
54 | ||
59fb8770 | 55 | void write_commit_graph_reachable(const char *obj_dir, int append); |
049d51a2 | 56 | void write_commit_graph(const char *obj_dir, |
d88b14b3 DS |
57 | struct string_list *pack_indexes, |
58 | struct string_list *commit_hex, | |
7547b95b | 59 | int append); |
08fd81c9 | 60 | |
283e68c7 DS |
61 | int verify_commit_graph(struct repository *r, struct commit_graph *g); |
62 | ||
c3756d5b JT |
63 | void free_commit_graph(struct commit_graph *); |
64 | ||
08fd81c9 | 65 | #endif |