1#ifndef COMMIT_GRAPH_H 2#define COMMIT_GRAPH_H 3 4#include"git-compat-util.h" 5 6char*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 */ 18intparse_commit_in_graph(struct commit *item); 19 20/* 21 * It is possible that we loaded commit contents from the commit buffer, 22 * but we also want to ensure the commit-graph content is correctly 23 * checked and filled. Fill the graph_pos and generation members of 24 * the given commit. 25 */ 26voidload_commit_graph_info(struct commit *item); 27 28struct tree *get_commit_tree_in_graph(const struct commit *c); 29 30struct commit_graph { 31int graph_fd; 32 33const unsigned char*data; 34size_t data_len; 35 36unsigned char hash_len; 37unsigned char num_chunks; 38uint32_t num_commits; 39struct object_id oid; 40 41const uint32_t*chunk_oid_fanout; 42const unsigned char*chunk_oid_lookup; 43const unsigned char*chunk_commit_data; 44const unsigned char*chunk_large_edges; 45}; 46 47struct commit_graph *load_commit_graph_one(const char*graph_file); 48 49voidwrite_commit_graph(const char*obj_dir, 50const char**pack_indexes, 51int nr_packs, 52const char**commit_hex, 53int nr_commits, 54int append); 55 56#endif