diff options
Diffstat (limited to 'refs/files-backend.c')
-rw-r--r-- | refs/files-backend.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/refs/files-backend.c b/refs/files-backend.c index 95acab78ee..8db7882aac 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -1136,8 +1136,7 @@ static void prune_ref(struct files_ref_store *refs, struct ref_to_prune *r) if (check_refname_format(r->name, 0)) return; - transaction = ref_store_transaction_begin(&refs->base, - REF_TRANSACTION_SKIP_HOOK, &err); + transaction = ref_store_transaction_begin(&refs->base, &err); if (!transaction) goto cleanup; ref_transaction_add_update( @@ -1208,8 +1207,7 @@ static int files_pack_refs(struct ref_store *ref_store, unsigned int flags) struct strbuf err = STRBUF_INIT; struct ref_transaction *transaction; - transaction = ref_store_transaction_begin(refs->packed_ref_store, - REF_TRANSACTION_SKIP_HOOK, &err); + transaction = ref_store_transaction_begin(refs->packed_ref_store, &err); if (!transaction) return -1; @@ -1266,7 +1264,6 @@ static int files_delete_refs(struct ref_store *ref_store, const char *msg, { struct files_ref_store *refs = files_downcast(ref_store, REF_STORE_WRITE, "delete_refs"); - struct ref_transaction *transaction = NULL; struct strbuf err = STRBUF_INIT; int i, result = 0; @@ -1276,15 +1273,10 @@ static int files_delete_refs(struct ref_store *ref_store, const char *msg, if (packed_refs_lock(refs->packed_ref_store, 0, &err)) goto error; - transaction = ref_store_transaction_begin(refs->packed_ref_store, - REF_TRANSACTION_SKIP_HOOK, &err); - if (!transaction) - goto error; - - result = packed_refs_delete_refs(refs->packed_ref_store, - transaction, msg, refnames, flags); - if (result) + if (refs_delete_refs(refs->packed_ref_store, msg, refnames, flags)) { + packed_refs_unlock(refs->packed_ref_store); goto error; + } packed_refs_unlock(refs->packed_ref_store); @@ -1295,7 +1287,6 @@ static int files_delete_refs(struct ref_store *ref_store, const char *msg, result |= error(_("could not remove reference %s"), refname); } - ref_transaction_free(transaction); strbuf_release(&err); return result; @@ -1312,7 +1303,6 @@ error: else error(_("could not delete references: %s"), err.buf); - ref_transaction_free(transaction); strbuf_release(&err); return -1; } @@ -2784,8 +2774,7 @@ static int files_transaction_prepare(struct ref_store *ref_store, */ if (!packed_transaction) { packed_transaction = ref_store_transaction_begin( - refs->packed_ref_store, - REF_TRANSACTION_SKIP_HOOK, err); + refs->packed_ref_store, err); if (!packed_transaction) { ret = TRANSACTION_GENERIC_ERROR; goto cleanup; @@ -3056,8 +3045,7 @@ static int files_initial_transaction_commit(struct ref_store *ref_store, &affected_refnames)) BUG("initial ref transaction called with existing refs"); - packed_transaction = ref_store_transaction_begin(refs->packed_ref_store, - REF_TRANSACTION_SKIP_HOOK, err); + packed_transaction = ref_store_transaction_begin(refs->packed_ref_store, err); if (!packed_transaction) { ret = TRANSACTION_GENERIC_ERROR; goto cleanup; |