@@ -1136,7 +1136,8 @@ 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, &err);
+ /* Called by "files_pack_refs()" and should not run any hooks. */
+ transaction = ref_store_transaction_begin_extended(&refs->base, 0, &err);
if (!transaction)
goto cleanup;
ref_transaction_add_update(
@@ -1207,7 +1208,12 @@ 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, &err);
+ /*
+ * No real changes have occurred to the repository and no hooks
+ * should be run for this transaction.
+ */
+ transaction = ref_store_transaction_begin_extended(refs->packed_ref_store,
+ 0, &err);
if (!transaction)
return -1;
@@ -392,9 +392,7 @@ test_expect_success "update-ref: update HEAD" '
test_cmp_heads_and_tags -C workdir expect
'
-# Failed because the reference-transaction hook was executed even
-# though no refs were changed by running git-pack-refs.
-test_expect_failure "update-ref: prepare packed_ref_store using pack-refs" '
+test_expect_success "update-ref: prepare packed_ref_store using pack-refs" '
test_when_finished "rm -f $HOOK_OUTPUT" &&
git -C workdir pack-refs --all &&
test_path_is_file workdir/.git/packed-refs &&
@@ -737,9 +735,7 @@ test_expect_success "branch: create new branches" '
test_cmp_heads_and_tags -C workdir expect
'
-# Failed because the reference-transaction hook was executed even
-# though no refs were changed by running git-gc.
-test_expect_failure "branch: prepare packed_ref_store using gc" '
+test_expect_success "branch: prepare packed_ref_store using gc" '
test_when_finished "rm -f $HOOK_OUTPUT" &&
git -C workdir gc &&
test_path_is_file workdir/.git/packed-refs &&
@@ -1014,9 +1010,7 @@ test_expect_success "tag: create new tags" '
test_cmp_heads_and_tags -C workdir expect
'
-# Failed because the reference-transaction hook was executed even
-# though no refs were changed by running git-pack-refs.
-test_expect_failure "tag: prepare packed_ref_store using pack-refs" '
+test_expect_success "tag: prepare packed_ref_store using pack-refs" '
test_when_finished "rm -f $HOOK_OUTPUT" &&
git -C workdir pack-refs --all &&
test_path_is_file workdir/.git/packed-refs &&