Merge branch 'tz/doc-git-urls-reference'
[git] / commit-graph.h
1 #ifndef COMMIT_GRAPH_H
2 #define COMMIT_GRAPH_H
3
4 #include "git-compat-util.h"
5
6 char *get_commit_graph_filename(const char *obj_dir);
7
8 /*
9  * Given a commit struct, try to fill the commit struct info, including:
10  *  1. tree object
11  *  2. date
12  *  3. parents.
13  *
14  * Returns 1 if and only if the commit was found in the packed graph.
15  *
16  * See parse_commit_buffer() for the fallback after this call.
17  */
18 int parse_commit_in_graph(struct commit *item);
19
20 struct commit_graph {
21         int graph_fd;
22
23         const unsigned char *data;
24         size_t data_len;
25
26         unsigned char hash_len;
27         unsigned char num_chunks;
28         uint32_t num_commits;
29         struct object_id oid;
30
31         const uint32_t *chunk_oid_fanout;
32         const unsigned char *chunk_oid_lookup;
33         const unsigned char *chunk_commit_data;
34         const unsigned char *chunk_large_edges;
35 };
36
37 struct commit_graph *load_commit_graph_one(const char *graph_file);
38
39 void write_commit_graph(const char *obj_dir,
40                         const char **pack_indexes,
41                         int nr_packs,
42                         const char **commit_hex,
43                         int nr_commits,
44                         int append);
45
46 #endif