refs.c: remove ref_transaction_rollback
We do not yet need both a rollback and a free function for transactions. Remove ref_transaction_rollback and use ref_transaction_free instead. At a later stage we may reintroduce a rollback function if we want to start adding reusable transactions and similar. Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Ronnie Sahlberg <sahlberg@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> Acked-by: Michael Haggerty <mhagger@alum.mit.edu>
Ronnie Sahlberg committed
Jun 20, 2014 at 07:42 UTC
026bd1d3e27a9e9b8f6b0098644c5753a2a1e355
2 files changed
+8
-15
refs.c
+1
-6
@@ -3334,7 +3334,7 @@ struct ref_transaction *ref_transaction_begin(void)
3334
return xcalloc(1, sizeof(struct ref_transaction));
3335
}
3336
3337
-static void ref_transaction_free(struct ref_transaction *transaction)
3337
+void ref_transaction_free(struct ref_transaction *transaction)
3338
{
3339
int i;
3340
@@ -3345,11 +3345,6 @@ static void ref_transaction_free(struct ref_transaction *transaction)
3345
free(transaction);
3346
}
3347
3348
-void ref_transaction_rollback(struct ref_transaction *transaction)
3349
-{
3350
- ref_transaction_free(transaction);
3351
-}
3352
-
3348
static struct ref_update *add_update(struct ref_transaction *transaction,
3349
const char *refname)
3350
{
refs.h
+7
-9
@@ -219,17 +219,11 @@ enum action_on_err {
219
220
/*
221
* Begin a reference transaction. The reference transaction must
222
- * eventually be commited using ref_transaction_commit() or rolled
223
- * back using ref_transaction_rollback().
222
+ * eventually be commited using ref_transaction_commit() or freed by
223
+ * calling ref_transaction_free().
224
*/
225
struct ref_transaction *ref_transaction_begin(void);
226
227
-/*
228
- * Roll back a ref_transaction and free all associated data.
229
- */
230
-void ref_transaction_rollback(struct ref_transaction *transaction);
231
-
232
-
227
/*
228
* The following functions add a reference check or update to a
229
* ref_transaction. In all of them, refname is the name of the
@@ -238,7 +232,6 @@ void ref_transaction_rollback(struct ref_transaction *transaction);
232
* can be REF_NODEREF; it is passed to update_ref_lock().
233
*/
234
241
-
235
/*
236
* Add a reference update to transaction. new_sha1 is the value that
237
* the reference should have after the update, or zeros if it should
@@ -280,6 +273,11 @@ void ref_transaction_delete(struct ref_transaction *transaction,
273
int ref_transaction_commit(struct ref_transaction *transaction,
274
const char *msg, enum action_on_err onerr);
275
276
+/*
277
+ * Free an existing transaction and all associated data.
278
+ */
279
+void ref_transaction_free(struct ref_transaction *transaction);
280
+
281
/** Lock a ref and then write its file */
282
int update_ref(const char *action, const char *refname,
283
const unsigned char *sha1, const unsigned char *oldval,