Git development
 help / color / mirror / Atom feed
From: Maciej Ciemborowicz <maciej.ciemborowicz@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Patrick Steinhardt" <ps@pks.im>,
	"Phil Hord" <phil.hord@gmail.com>,
	"Elijah Newren" <newren@gmail.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"D . Ben Knoble" <ben.knoble@gmail.com>,
	"Maciej Ciemborowicz" <maciej.ciemborowicz@gmail.com>
Subject: [PATCH 0/3] refs: report old OIDs for batched deletions
Date: Sat, 19 Sep 2026 22:11:55 +0200	[thread overview]
Message-ID: <20260919201158.43415-1-maciej.ciemborowicz@gmail.com> (raw)
In-Reply-To: <CACQ=SRHthWOLVXmY6wgknOPgpQ+oB1vV-Q0AL=mK9mXb2Xy9Nw@mail.gmail.com>

This follows up on the reference-transaction bug report at [1].

The reference-transaction hook reports an all-zero update when `git branch
-d`, `git tag -d`, `git remote prune`, or `git fetch --prune` deletes a
ref. This prevents hook consumers from identifying the object that the ref
pointed to.

For branch and tag deletion, this is a regression caused by 8198907795 (use
delete_refs when deleting tags or branches, 2021-01-21). That change made
large deletions much faster by batching them, but the batch helper did not
accept the old OIDs that both callers had already resolved. The pruning paths
have the same omission.

Teach refs_delete_refs() to accept optional old OIDs, then pass the values
already available to the branch, tag, fetch, and remote callers. This keeps a
single batched transaction and does not add any ref reads.

Deleting 10,000 packed tags took a median of 0.86 seconds before this series
and 0.85 seconds after it across five runs, which is within measurement noise.

The regression tests use packed refs and cover the files and reftable
backends, distinct old OIDs, and regular and atomic fetch pruning. The full
test suite passes with DEVELOPER=1. Additional checks covered SHA-1, SHA-256,
broken and symbolic refs, and refs shadowed between loose and packed storage.

[1] https://lore.kernel.org/git/CACQ=SRGTTdQ+dHXhN6F52dBv5KxZBRfk_Em2fvmEmGJDoB6oTg@mail.gmail.com/

Maciej Ciemborowicz (3):
  refs: allow callers to supply old OIDs for batch deletion
  branch, tag: retain old OIDs in batched deletions
  fetch, remote: retain old OIDs when pruning refs

 bisect.c                         |  2 +-
 builtin/branch.c                 |  7 +++-
 builtin/fetch.c                  | 11 +++--
 builtin/remote.c                 | 33 ++++++++++++---
 builtin/tag.c                    |  7 +++-
 refs.c                           | 26 +++++++-----
 refs.h                           | 12 +++++-
 t/helper/test-ref-store.c        |  2 +-
 t/t1416-ref-transaction-hooks.sh | 70 ++++++++++++++++++++++++++++++++
 9 files changed, 144 insertions(+), 26 deletions(-)


base-commit: e9019fcafe0040228b8631c30f97ae1adb61bcdc
-- 
2.39.3 (Apple Git-146)


  reply	other threads:[~2026-09-19 20:12 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-19 13:34 [BUG] reference-transaction reports zero OIDs for branch and tag deletion Maciej Ciemborowicz
2026-09-19 14:59 ` D. Ben Knoble
2026-09-19 15:42   ` Maciej Ciemborowicz
2026-09-19 20:11     ` Maciej Ciemborowicz [this message]
2026-09-19 20:11       ` [PATCH 1/3] refs: allow callers to supply old OIDs for batch deletion Maciej Ciemborowicz
2026-09-19 20:41         ` Karthik Nayak
2026-09-20 10:38           ` Maciej Ciemborowicz
2026-09-20 10:54           ` [PATCH v2 0/3] refs: report old OIDs for batched deletions Maciej Ciemborowicz
2026-09-20 10:54             ` [PATCH v2 1/3] refs: allow callers to supply old OIDs for batch deletion Maciej Ciemborowicz
2026-09-21 13:12               ` Karthik Nayak
2026-09-21 23:55               ` Junio C Hamano
2026-09-20 10:54             ` [PATCH v2 2/3] branch, tag: retain old OIDs in batched deletions Maciej Ciemborowicz
2026-09-21 13:19               ` Karthik Nayak
2026-09-20 10:54             ` [PATCH v2 3/3] fetch, remote: retain old OIDs when pruning refs Maciej Ciemborowicz
2026-09-21 13:56               ` Karthik Nayak
2026-09-21 13:57             ` [PATCH v2 0/3] refs: report old OIDs for batched deletions Karthik Nayak
2026-09-21 20:01               ` Maciej Ciemborowicz
2026-09-22 12:26             ` [PATCH v3 " Maciej Ciemborowicz
2026-09-22 12:26               ` [PATCH v3 1/3] refs: allow callers to supply old OIDs for batch deletion Maciej Ciemborowicz
2026-09-22 18:55                 ` Junio C Hamano
2026-09-22 19:21                   ` Maciej Ciemborowicz
2026-09-22 23:31                     ` Junio C Hamano
2026-09-22 12:26               ` [PATCH v3 2/3] branch, tag: retain old OIDs in batched deletions Maciej Ciemborowicz
2026-09-22 12:26               ` [PATCH v3 3/3] fetch, remote: retain old OIDs when pruning refs Maciej Ciemborowicz
2026-09-22 19:16                 ` Junio C Hamano
2026-09-22 22:29               ` [PATCH v4 0/3] refs: report old OIDs for batched deletions Maciej Ciemborowicz
2026-09-22 22:31                 ` [PATCH v4 1/3] refs: allow callers to supply old OIDs for batch deletion Maciej Ciemborowicz
2026-09-22 22:31                 ` [PATCH v4 2/3] branch, tag: retain old OIDs in batched deletions Maciej Ciemborowicz
2026-09-22 22:31                 ` [PATCH v4 3/3] fetch, remote: retain old OIDs when pruning refs Maciej Ciemborowicz
2026-09-23 20:03                   ` Junio C Hamano
2026-09-23 21:02                     ` Maciej Ciemborowicz
2026-09-23 21:04                 ` [PATCH v5 0/3] refs: report old OIDs for batched deletions Maciej Ciemborowicz
2026-09-23 21:04                   ` [PATCH v5 1/3] refs: allow callers to supply old OIDs for batch deletion Maciej Ciemborowicz
2026-09-24 10:04                     ` Karthik Nayak
2026-09-24 16:34                       ` Junio C Hamano
2026-09-24 19:43                       ` Maciej Ciemborowicz
2026-09-24 11:07                     ` Patrick Steinhardt
2026-09-24 16:45                       ` Junio C Hamano
2026-09-24 20:13                         ` Maciej Ciemborowicz
2026-09-28  6:44                           ` Patrick Steinhardt
2026-09-28  6:43                         ` Patrick Steinhardt
2026-09-24 19:56                       ` Maciej Ciemborowicz
2026-09-23 21:04                   ` [PATCH v5 2/3] branch, tag: retain old OIDs in batched deletions Maciej Ciemborowicz
2026-09-24 11:08                     ` Patrick Steinhardt
2026-09-23 21:04                   ` [PATCH v5 3/3] fetch, remote: retain old OIDs when pruning refs Maciej Ciemborowicz
2026-09-23 21:55                   ` [PATCH v5 0/3] refs: report old OIDs for batched deletions Junio C Hamano
2026-09-24 22:33                   ` [PATCH v6 0/1] refs: report old values to transaction hooks Maciej Ciemborowicz
2026-09-24 22:33                     ` [PATCH v6 1/1] " Maciej Ciemborowicz
2026-09-30  3:11                       ` Maciej Ciemborowicz
2026-10-01 17:37                         ` Maciej Ciemborowicz
2026-09-19 20:11       ` [PATCH 2/3] branch, tag: retain old OIDs in batched deletions Maciej Ciemborowicz
2026-09-19 20:11       ` [PATCH 3/3] fetch, remote: retain old OIDs when pruning refs Maciej Ciemborowicz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260919201158.43415-1-maciej.ciemborowicz@gmail.com \
    --to=maciej.ciemborowicz@gmail.com \
    --cc=avarab@gmail.com \
    --cc=ben.knoble@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=newren@gmail.com \
    --cc=phil.hord@gmail.com \
    --cc=ps@pks.im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox