@@ -64,6 +64,12 @@ struct git_refdb_backend {
6464 * Queries the refdb backend for the existence of a reference.
6565 *
6666 * A refdb implementation must provide this function.
67+ *
68+ * @arg exists The implementation shall set this to `0` if a ref does
69+ * not exist, otherwise to `1`.
70+ * @arg ref_name The reference's name that should be checked for
71+ * existence.
72+ * @return `0` on success, a negative error value code.
6773 */
6874 int GIT_CALLBACK (exists )(
6975 int * exists ,
@@ -74,6 +80,13 @@ struct git_refdb_backend {
7480 * Queries the refdb backend for a given reference.
7581 *
7682 * A refdb implementation must provide this function.
83+ *
84+ * @arg out The implementation shall set this to the allocated
85+ * reference, if it could be found, otherwise to `NULL`.
86+ * @arg ref_name The reference's name that should be checked for
87+ * existence.
88+ * @return `0` on success, `GIT_ENOTFOUND` if the reference does
89+ * exist, otherwise a negative error code.
7790 */
7891 int GIT_CALLBACK (lookup )(
7992 git_reference * * out ,
@@ -84,6 +97,16 @@ struct git_refdb_backend {
8497 * Allocate an iterator object for the backend.
8598 *
8699 * A refdb implementation must provide this function.
100+ *
101+ * @arg out The implementation shall set this to the allocated
102+ * reference iterator. A custom structure may be used with an
103+ * embedded `git_reference_iterator` structure. Both `next`
104+ * and `next_name` functions of `git_reference_iterator` need
105+ * to be populated.
106+ * @arg glob A pattern to filter references by. If given, the iterator
107+ * shall only return references that match the glob when
108+ * passed to `wildmatch`.
109+ * @return `0` on success, otherwise a negative error code.
87110 */
88111 int GIT_CALLBACK (iterator )(
89112 git_reference_iterator * * iter ,
@@ -94,6 +117,27 @@ struct git_refdb_backend {
94117 * Writes the given reference to the refdb.
95118 *
96119 * A refdb implementation must provide this function.
120+ *
121+ * @arg ref The reference to persist. May either be a symbolic or
122+ * direct reference.
123+ * @arg force Whether to write the reference if a reference with the
124+ * same name already exists.
125+ * @arg who The person updating the reference. Shall be used to create
126+ * a reflog entry.
127+ * @arg message The message detailing what kind of reference update is
128+ * performed. Shall be used to create a reflog entry.
129+ * @arg old If not `NULL` and `force` is not set, then the
130+ * implementation needs to ensure that the reference is currently at
131+ * the given OID before writing the new value. If both `old`
132+ * and `old_target` are `NULL`, then the reference should not
133+ * exist at the point of writing.
134+ * @arg old_target If not `NULL` and `force` is not set, then the
135+ * implementation needs to ensure that the symbolic
136+ * reference is currently at the given target before
137+ * writing the new value. If both `old` and
138+ * `old_target` are `NULL`, then the reference should
139+ * not exist at the point of writing.
140+ * @return `0` on success, otherwise a negative error code.
97141 */
98142 int GIT_CALLBACK (write )(git_refdb_backend * backend ,
99143 const git_reference * ref , int force ,
@@ -104,6 +148,18 @@ struct git_refdb_backend {
104148 * Rename a reference in the refdb.
105149 *
106150 * A refdb implementation must provide this function.
151+ *
152+ * @arg out The implementation shall set this to the newly created
153+ * reference or `NULL` on error.
154+ * @arg old_name The current name of the reference that is to be renamed.
155+ * @arg new_name The new name that the old reference shall be renamed to.
156+ * @arg force Whether to write the reference if a reference with the
157+ * target name already exists.
158+ * @arg who The person updating the reference. Shall be used to create
159+ * a reflog entry.
160+ * @arg message The message detailing what kind of reference update is
161+ * performed. Shall be used to create a reflog entry.
162+ * @return `0` on success, otherwise a negative error code.
107163 */
108164 int GIT_CALLBACK (rename )(
109165 git_reference * * out , git_refdb_backend * backend ,
@@ -116,6 +172,16 @@ struct git_refdb_backend {
116172 * If it exists, its reflog should be deleted as well.
117173 *
118174 * A refdb implementation must provide this function.
175+ *
176+ * @arg ref_name The name of the reference name that shall be deleted.
177+ * @arg old_id If not `NULL` and `force` is not set, then the
178+ * implementation needs to ensure that the reference is currently at
179+ * the given OID before writing the new value.
180+ * @arg old_target If not `NULL` and `force` is not set, then the
181+ * implementation needs to ensure that the symbolic
182+ * reference is currently at the given target before
183+ * writing the new value.
184+ * @return `0` on success, otherwise a negative error code.
119185 */
120186 int GIT_CALLBACK (del )(git_refdb_backend * backend , const char * ref_name , const git_oid * old_id , const char * old_target );
121187
@@ -127,13 +193,21 @@ struct git_refdb_backend {
127193 *
128194 * A refdb implementation may provide this function; if it is not
129195 * provided, nothing will be done.
196+ *
197+ * @return `0` on success a negative error code otherwise
130198 */
131199 int GIT_CALLBACK (compress )(git_refdb_backend * backend );
132200
133201 /**
134202 * Query whether a particular reference has a log (may be empty)
135203 *
204+ * Shall return 1 if it has a reflog, 0 it it doesn't and negative in
205+ * case an error occurred.
206+ *
136207 * A refdb implementation must provide this function.
208+ *
209+ * @return `0` on success, `1` if the reflog for the given reference
210+ * exists, a negative error code otherwise
137211 */
138212 int GIT_CALLBACK (has_log )(git_refdb_backend * backend , const char * refname );
139213
@@ -142,6 +216,8 @@ struct git_refdb_backend {
142216 * will be appended to on writes.
143217 *
144218 * A refdb implementation must provide this function.
219+ *
220+ * @return `0` on success, a negative error code otherwise
145221 */
146222 int GIT_CALLBACK (ensure_log )(git_refdb_backend * backend , const char * refname );
147223
@@ -157,37 +233,54 @@ struct git_refdb_backend {
157233 * Read the reflog for the given reference name.
158234 *
159235 * A refdb implementation must provide this function.
236+ *
237+ * @return `0` on success, a negative error code otherwise
160238 */
161239 int GIT_CALLBACK (reflog_read )(git_reflog * * out , git_refdb_backend * backend , const char * name );
162240
163241 /**
164242 * Write a reflog to disk.
165243 *
166244 * A refdb implementation must provide this function.
245+ *
246+ * @arg reflog The complete reference log for a given reference. Note
247+ * that this may contain entries that have already been
248+ * written to disk.
249+ * @return `0` on success, a negative error code otherwise
167250 */
168251 int GIT_CALLBACK (reflog_write )(git_refdb_backend * backend , git_reflog * reflog );
169252
170253 /**
171254 * Rename a reflog.
172255 *
173256 * A refdb implementation must provide this function.
257+ *
258+ * @arg old_name The name of old reference whose reflog shall be renamed from.
259+ * @arg new_name The name of new reference whose reflog shall be renamed to.
260+ * @return `0` on success, a negative error code otherwise
174261 */
175262 int GIT_CALLBACK (reflog_rename )(git_refdb_backend * _backend , const char * old_name , const char * new_name );
176263
177264 /**
178265 * Remove a reflog.
179266 *
180267 * A refdb implementation must provide this function.
268+ *
269+ * @arg name The name of the reference whose reflog shall be deleted.
270+ * @return `0` on success, a negative error code otherwise
181271 */
182272 int GIT_CALLBACK (reflog_delete )(git_refdb_backend * backend , const char * name );
183273
184274 /**
185275 * Lock a reference.
186276 *
187- * The opaque parameter will be passed to the unlock function.
188- *
189277 * A refdb implementation may provide this function; if it is not
190278 * provided, the transaction API will fail to work.
279+ *
280+ * @arg payload_out Opaque parameter that will be passed verbosely to
281+ * `unlock`.
282+ * @arg refname Reference that shall be locked.
283+ * @return `0` on success, a negative error code otherwise
191284 */
192285 int GIT_CALLBACK (lock )(void * * payload_out , git_refdb_backend * backend , const char * refname );
193286
@@ -200,6 +293,20 @@ struct git_refdb_backend {
200293 *
201294 * A refdb implementation must provide this function if a `lock`
202295 * implementation is provided.
296+ *
297+ * @arg payload The payload returned by `lock`.
298+ * @arg success `1` if a reference should be updated, `2` if
299+ * a reference should be deleted, `0` if the lock must be
300+ * discarded.
301+ * @arg update_reflog `1` in case the reflog should be updated, `0`
302+ * otherwise.
303+ * @arg ref The reference which should be unlocked.
304+ * @arg who The person updating the reference. Shall be used to create
305+ * a reflog entry in case `update_reflog` is set.
306+ * @arg message The message detailing what kind of reference update is
307+ * performed. Shall be used to create a reflog entry in
308+ * case `update_reflog` is set.
309+ * @return `0` on success, a negative error code otherwise
203310 */
204311 int GIT_CALLBACK (unlock )(git_refdb_backend * backend , void * payload , int success , int update_reflog ,
205312 const git_reference * ref , const git_signature * sig , const char * message );
0 commit comments