summaryrefslogtreecommitdiff
path: root/refs/files-backend.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-04-13 22:51:33 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-04-13 22:51:33 (GMT)
commitc6da34a610e58f7e58042b5ed24a19bd2c18e928 (patch)
treefa92224f86cee761f510325d8e7e0d2f55d6fd88 /refs/files-backend.c
parent1ac7422e39b0043250b026f9988d0da24cb2cb58 (diff)
downloadgit-c6da34a610e58f7e58042b5ed24a19bd2c18e928.zip
git-c6da34a610e58f7e58042b5ed24a19bd2c18e928.tar.gz
git-c6da34a610e58f7e58042b5ed24a19bd2c18e928.tar.bz2
Revert "Merge branch 'ps/avoid-unnecessary-hook-invocation-with-packed-refs'"
This reverts commit 991b4d47f0accd3955d05927d5ce434e03ffbdb6, reversing changes made to bcd020f88e1e22f38422ac3f73ab06b34ec4bef1.
Diffstat (limited to 'refs/files-backend.c')
-rw-r--r--refs/files-backend.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/refs/files-backend.c b/refs/files-backend.c
index 95acab7..8db7882 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;