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
/*
* 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/indexer.h
* @brief Packfile indexing
* @ingroup Git
* @{
*
* Indexing is the operation of taking a packfile - which is simply a
* collection of unordered commits - and producing an "index" so that
* one can lookup a commit in the packfile by object ID.
*/
/** A git indexer object */
typedef struct git_indexer git_indexer;
/**
* This structure is used to provide callers information about the
* progress of indexing a packfile, either directly or part of a
* fetch or clone that downloads a packfile.
*/
typedef struct git_indexer_progress git_indexer_progress;
/**
* Type for progress callbacks during indexing. Return a value less
* than zero to cancel the indexing or download.
*
* @param stats Structure containing information about the state of the transfer
* @param payload Payload provided by caller
* @return 0 on success or an error code
*/
typedef int ;
/**
* Options for indexer configuration
*/
typedef struct git_indexer_options git_indexer_options;
/** Current version for the `git_indexer_options` structure */
/** Static constructor for `git_indexer_options` */
/**
* Initializes a `git_indexer_options` with default values. Equivalent to
* creating an instance with GIT_INDEXER_OPTIONS_INIT.
*
* @param opts the `git_indexer_options` struct to initialize.
* @param version Version of struct; pass `GIT_INDEXER_OPTIONS_VERSION`
* @return Zero on success; -1 on failure.
*/
;
/**
* Create a new indexer instance
*
* @param out where to store the indexer instance
* @param path to the directory where the packfile should be stored
* @param opts the options to create the indexer with
* @return 0 or an error code.
*/
;
/**
* Create a new indexer instance
*
* @param out where to store the indexer instance
* @param path to the directory where the packfile should be stored
* @param mode permissions to use creating packfile or 0 for defaults
* @param odb object database from which to read base objects when
* fixing thin packs. Pass NULL if no thin pack is expected (an error
* will be returned if there are bases missing)
* @param opts Optional structure containing additional options. See
* `git_indexer_options` above.
* @return 0 or an error code.
*/
;
/**
* Add data to the indexer
*
* @param idx the indexer
* @param data the data to add
* @param size the size of the data in bytes
* @param stats stat storage
* @return 0 or an error code.
*/
;
/**
* Finalize the pack and index
*
* Resolve any pending deltas and write out the index file
*
* @param idx the indexer
* @param stats Stat storage.
* @return 0 or an error code.
*/
;
/**
* Get the packfile's hash
*
* A packfile's name is derived from the sorted hashing of all object
* names. This is only correct after the index has been finalized.
*
* @deprecated use git_indexer_name
* @param idx the indexer instance
* @return the packfile's hash
*/
;
/**
* Get the unique name for the resulting packfile.
*
* The packfile's name is derived from the packfile's content.
* This is only correct after the index has been finalized.
*
* @param idx the indexer instance
* @return a NUL terminated string for the packfile name
*/
;
/**
* Free the indexer and its resources
*
* @param idx the indexer to free
*/
;
/** @} */