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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
/*
* Copyright (C) the libgit2 contributors. All rights reserved.
*
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
/**
* @file git2/sys/commit_graph.h
* @brief Commit graphs store information about commit relationships
* @defgroup git_commit_graph Commit graphs
* @ingroup Git
* @{
*/
/**
* Options structure for `git_commit_graph_open_new`.
*
* Initialize with `GIT_COMMIT_GRAPH_OPEN_OPTIONS_INIT`. Alternatively,
* you can use `git_commit_graph_open_options_init`.
*/
typedef struct git_commit_graph_open_options;
/** Current version for the `git_commit_graph_open_options` structure */
/** Static constructor for `git_commit_graph_open_options` */
/**
* Initialize git_commit_graph_open_options structure
*
* Initializes a `git_commit_graph_open_options` with default values.
* Equivalent to creating an instance with
* `GIT_COMMIT_GRAPH_OPEN_OPTIONS_INIT`.
*
* @param opts The `git_commit_graph_open_options` struct to initialize.
* @param version The struct version; pass `GIT_COMMIT_GRAPH_OPEN_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure.
*/
;
/**
* Opens a `git_commit_graph` from a path to an objects directory.
*
* This finds, opens, and validates the `commit-graph` file.
*
* @param cgraph_out the `git_commit_graph` struct to initialize.
* @param objects_dir the path to a git objects directory.
* @return Zero on success; -1 on failure.
*/
;
/**
* Frees commit-graph data. This should only be called when memory allocated
* using `git_commit_graph_open` is not returned to libgit2 because it was not
* associated with the ODB through a successful call to
* `git_odb_set_commit_graph`.
*
* @param cgraph the commit-graph object to free. If NULL, no action is taken.
*/
;
/**
* The strategy to use when adding a new set of commits to a pre-existing
* commit-graph chain.
*/
typedef enum git_commit_graph_split_strategy_t;
/**
* Options structure for `git_commit_graph_writer_new`.
*
* Initialize with `GIT_COMMIT_GRAPH_WRITER_OPTIONS_INIT`. Alternatively,
* you can use `git_commit_graph_writer_options_init`.
*/
typedef struct git_commit_graph_writer_options;
/** Current version for the `git_commit_graph_writer_options` structure */
/** Static constructor for `git_commit_graph_writer_options` */
/**
* Initialize git_commit_graph_writer_options structure
*
* Initializes a `git_commit_graph_writer_options` with default values. Equivalent to
* creating an instance with `GIT_COMMIT_GRAPH_WRITER_OPTIONS_INIT`.
*
* @param opts The `git_commit_graph_writer_options` struct to initialize.
* @param version The struct version; pass `GIT_COMMIT_GRAPH_WRITER_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure.
*/
;
/**
* Create a new writer for `commit-graph` files.
*
* @param out Location to store the writer pointer.
* @param objects_info_dir The `objects/info` directory.
* The `commit-graph` file will be written in this directory.
* @param options The options for the commit graph writer.
* @return 0 or an error code
*/
;
/**
* Free the commit-graph writer and its resources.
*
* @param w The writer to free. If NULL no action is taken.
*/
;
/**
* Add an `.idx` file (associated to a packfile) to the writer.
*
* @param w The writer.
* @param repo The repository that owns the `.idx` file.
* @param idx_path The path of an `.idx` file.
* @return 0 or an error code
*/
;
/**
* Add a revwalk to the writer. This will add all the commits from the revwalk
* to the commit-graph.
*
* @param w The writer.
* @param walk The git_revwalk.
* @return 0 or an error code
*/
;
/**
* Write a `commit-graph` file to a file.
*
* @param w The writer
* @return 0 or an error code
*/
;
/**
* Dump the contents of the `commit-graph` to an in-memory buffer.
*
* @param[out] buffer Buffer where to store the contents of the `commit-graph`.
* @param w The writer.
* @return 0 or an error code
*/
;
/** @} */