Thread (43 messages) flat view 43 messages, 5 authors, 49m ago

Re: [BUG] reference-transaction reports zero OIDs for branch and tag deletion

From: Maciej Ciemborowicz <hidden>
Date: 2026-09-19 15:43:13

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:
ref_transaction_delete(transaction, refname, NULL, NULL, ...)
Without the old OID, the `REF_HAVE_OLD` flag is not set, so the hook receives:
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 [off-list ref] wrote:
On Sat, Sep 19, 2026 at 9:34 AM Maciej Ciemborowicz
[off-list ref] wrote:
quoted
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]
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help