@@ -58,20 +58,22 @@ struct git_reference_iterator {
5858
5959/** An instance for a custom backend */
6060struct git_refdb_backend {
61- unsigned int version ;
61+ unsigned int version ; /**< The backend API version */
6262
6363 /**
64- * Queries the refdb backend to determine if the given ref_name
65- * exists. A refdb implementation must provide this function.
64+ * Queries the refdb backend for the existence of a reference.
65+ *
66+ * A refdb implementation must provide this function.
6667 */
6768 int GIT_CALLBACK (exists )(
6869 int * exists ,
6970 git_refdb_backend * backend ,
7071 const char * ref_name );
7172
7273 /**
73- * Queries the refdb backend for a given reference. A refdb
74- * implementation must provide this function.
74+ * Queries the refdb backend for a given reference.
75+ *
76+ * A refdb implementation must provide this function.
7577 */
7678 int GIT_CALLBACK (lookup )(
7779 git_reference * * out ,
@@ -88,82 +90,116 @@ struct git_refdb_backend {
8890 struct git_refdb_backend * backend ,
8991 const char * glob );
9092
91- /*
92- * Writes the given reference to the refdb. A refdb implementation
93- * must provide this function.
93+ /**
94+ * Writes the given reference to the refdb.
95+ *
96+ * A refdb implementation must provide this function.
9497 */
9598 int GIT_CALLBACK (write )(git_refdb_backend * backend ,
9699 const git_reference * ref , int force ,
97100 const git_signature * who , const char * message ,
98101 const git_oid * old , const char * old_target );
99102
103+ /**
104+ * Rename a reference in the refdb.
105+ *
106+ * A refdb implementation must provide this function.
107+ */
100108 int GIT_CALLBACK (rename )(
101109 git_reference * * out , git_refdb_backend * backend ,
102110 const char * old_name , const char * new_name , int force ,
103111 const git_signature * who , const char * message );
104112
105113 /**
106- * Deletes the given reference (and if necessary its reflog)
107- * from the refdb. A refdb implementation must provide this
108- * function.
114+ * Deletes the given reference from the refdb.
115+ *
116+ * If it exists, its reflog should be deleted as well.
117+ *
118+ * A refdb implementation must provide this function.
109119 */
110120 int GIT_CALLBACK (del )(git_refdb_backend * backend , const char * ref_name , const git_oid * old_id , const char * old_target );
111121
112122 /**
113123 * Suggests that the given refdb compress or optimize its references.
114- * This mechanism is implementation specific. (For on-disk reference
115- * databases, this may pack all loose references.) A refdb
116- * implementation may provide this function; if it is not provided,
117- * nothing will be done.
124+ *
125+ * This mechanism is implementation specific. For on-disk reference
126+ * databases, this may pack all loose references.
127+ *
128+ * A refdb implementation may provide this function; if it is not
129+ * provided, nothing will be done.
118130 */
119131 int GIT_CALLBACK (compress )(git_refdb_backend * backend );
120132
121133 /**
122134 * Query whether a particular reference has a log (may be empty)
135+ *
136+ * A refdb implementation must provide this function.
123137 */
124138 int GIT_CALLBACK (has_log )(git_refdb_backend * backend , const char * refname );
125139
126140 /**
127141 * Make sure a particular reference will have a reflog which
128142 * will be appended to on writes.
143+ *
144+ * A refdb implementation must provide this function.
129145 */
130146 int GIT_CALLBACK (ensure_log )(git_refdb_backend * backend , const char * refname );
131147
132148 /**
133149 * Frees any resources held by the refdb (including the `git_refdb_backend`
134- * itself). A refdb backend implementation must provide this function.
150+ * itself).
151+ *
152+ * A refdb backend implementation must provide this function.
135153 */
136154 void GIT_CALLBACK (free )(git_refdb_backend * backend );
137155
138156 /**
139157 * Read the reflog for the given reference name.
158+ *
159+ * A refdb implementation must provide this function.
140160 */
141161 int GIT_CALLBACK (reflog_read )(git_reflog * * out , git_refdb_backend * backend , const char * name );
142162
143163 /**
144164 * Write a reflog to disk.
165+ *
166+ * A refdb implementation must provide this function.
145167 */
146168 int GIT_CALLBACK (reflog_write )(git_refdb_backend * backend , git_reflog * reflog );
147169
148170 /**
149- * Rename a reflog
171+ * Rename a reflog.
172+ *
173+ * A refdb implementation must provide this function.
150174 */
151175 int GIT_CALLBACK (reflog_rename )(git_refdb_backend * _backend , const char * old_name , const char * new_name );
152176
153177 /**
154178 * Remove a reflog.
179+ *
180+ * A refdb implementation must provide this function.
155181 */
156182 int GIT_CALLBACK (reflog_delete )(git_refdb_backend * backend , const char * name );
157183
158184 /**
159- * Lock a reference. The opaque parameter will be passed to the unlock function
185+ * Lock a reference.
186+ *
187+ * The opaque parameter will be passed to the unlock function.
188+ *
189+ * A refdb implementation may provide this function; if it is not
190+ * provided, the transaction API will fail to work.
160191 */
161192 int GIT_CALLBACK (lock )(void * * payload_out , git_refdb_backend * backend , const char * refname );
162193
163194 /**
164- * Unlock a reference. Only one of target or symbolic_target
165- * will be set. success indicates whether to update the
166- * reference or discard the lock (if it's false)
195+ * Unlock a reference.
196+ *
197+ * Only one of target or symbolic_target will be set.
198+ * `success` will be true if the reference should be update, false if
199+ * the lock must be discarded.
200+ *
201+ * A refdb implementation must provide this function if a `lock`
202+ * implementation is provided.
167203 */
168204 int GIT_CALLBACK (unlock )(git_refdb_backend * backend , void * payload , int success , int update_reflog ,
169205 const git_reference * ref , const git_signature * sig , const char * message );
0 commit comments