From: Maciej Ciemborowicz Date: Sat, 19 Sep 2026 15:42:59 GMT Subject: Re: [BUG] reference-transaction reports zero OIDs for branch and tag deletion Message-ID: In-Reply-To: Commit `6754159767` introduced `reference-transaction` in Git 2.28. In Git 2.28-2.30, `git branch -D` and `git tag -d` used `delete_ref()` with the known old OID. Commit `8198907795`, before Git 2.31, replaced single-ref deletion with `delete_refs()`. The new function preserved only the ref names and called: ```c ref_transaction_delete(transaction, refname, NULL, NULL, ...) ``` Without the old OID, the `REF_HAVE_OLD` flag is not set, so the hook receives: ```text 000000... 000000... refs/heads/topic ``` The change was intended to speed up deletion of 24,000 tags from roughly 30 minutes to 5 seconds. The loss of information exposed to the hook appears to have been a side effect. So I assume this is a bug introduced by that optimization, and it should be fixed in a way that preserves the performance improvement. That seems feasible. Cheers, Maciej Ciemborowicz On Sat, Sep 19, 2026 at 4:59 PM D. Ben Knoble wrote: > > On Sat, Sep 19, 2026 at 9:34 AM Maciej Ciemborowicz > wrote: > > > > Since Git 2.31, the reference-transaction hook receives all-zero old and > > new object IDs when a branch or tag is deleted with a high-level command. > > [snip] > > > Was this loss of information intentional? If not, could the previous > > object ID be restored for these deletion paths? If it is intentional, > > the documentation may need to clarify that high-level deletion commands > > can provide a zero-to-zero record. > > Since you seem to have identified a "good" and "bad" version with a > reproduction script, I suspect "git bisect" is a good way to answer > your questions about intent. > > -- > D. Ben Knoble