Expand file tree
/
Copy pathcommit-graph.h
More file actions
Latest commit
110 lines (89 loc) · 3.26 KB
/
Copy pathcommit-graph.h
File metadata and controls
110 lines (89 loc) · 3.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#ifndefCOMMIT_GRAPH_H
#defineCOMMIT_GRAPH_H
#include"git-compat-util.h"
#include"repository.h"
#include"string-list.h"
#include"cache.h"
#defineGIT_TEST_COMMIT_GRAPH "GIT_TEST_COMMIT_GRAPH"
#defineGIT_TEST_COMMIT_GRAPH_DIE_ON_LOAD "GIT_TEST_COMMIT_GRAPH_DIE_ON_LOAD"
structcommit;
char*get_commit_graph_filename(constchar*obj_dir);
intopen_commit_graph(constchar*graph_file, int*fd, structstat*st);
/*
* Given a commit struct, try to fill the commit struct info, including:
* 1. tree object
* 2. date
* 3. parents.
*
* Returns 1 if and only if the commit was found in the packed graph.
*
* See parse_commit_buffer() for the fallback after this call.
*/
intparse_commit_in_graph(structrepository*r, structcommit*item);
/*
* It is possible that we loaded commit contents from the commit buffer,
* but we also want to ensure the commit-graph content is correctly
* checked and filled. Fill the graph_pos and generation members of
* the given commit.
*/
voidload_commit_graph_info(structrepository*r, structcommit*item);
structtree*get_commit_tree_in_graph(structrepository*r,
conststructcommit*c);
structcommit_graph {
intgraph_fd;
constunsigned char*data;
size_tdata_len;
unsigned charhash_len;
unsigned charnum_chunks;
uint32_tnum_commits;
structobject_idoid;
char*filename;
constchar*obj_dir;
uint32_tnum_commits_in_base;
structcommit_graph*base_graph;
constuint32_t*chunk_oid_fanout;
constunsigned char*chunk_oid_lookup;
constunsigned char*chunk_commit_data;
constunsigned char*chunk_extra_edges;
constunsigned char*chunk_base_graphs;
};
structcommit_graph*load_commit_graph_one_fd_st(intfd, structstat*st);
structcommit_graph*read_commit_graph_one(structrepository*r, constchar*obj_dir);
structcommit_graph*parse_commit_graph(void*graph_map, intfd,
size_tgraph_size);
/*
* Return 1 if and only if the repository has a commit-graph
* file and generation numbers are computed in that file.
*/
intgeneration_numbers_enabled(structrepository*r);
enumcommit_graph_write_flags {
COMMIT_GRAPH_WRITE_APPEND= (1 << 0),
COMMIT_GRAPH_WRITE_PROGRESS= (1 << 1),
COMMIT_GRAPH_WRITE_SPLIT= (1 << 2),
/* Make sure that each OID in the input is a valid commit OID. */
COMMIT_GRAPH_WRITE_CHECK_OIDS= (1 << 3)
};
structsplit_commit_graph_opts {
intsize_multiple;
intmax_commits;
timestamp_texpire_time;
};
/*
* The write_commit_graph* methods return zero on success
* and a negative value on failure. Note that if the repository
* is not compatible with the commit-graph feature, then the
* methods will return 0 without writing a commit-graph.
*/
intwrite_commit_graph_reachable(constchar*obj_dir,
enumcommit_graph_write_flagsflags,
conststructsplit_commit_graph_opts*split_opts);
intwrite_commit_graph(constchar*obj_dir,
structstring_list*pack_indexes,
structstring_list*commit_hex,
enumcommit_graph_write_flagsflags,
conststructsplit_commit_graph_opts*split_opts);
#defineCOMMIT_GRAPH_VERIFY_SHALLOW (1 << 0)
intverify_commit_graph(structrepository*r, structcommit_graph*g, intflags);
voidclose_commit_graph(structraw_object_store*);
voidfree_commit_graph(structcommit_graph*);
#endif