git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 0/4] refs: remove virtual `delete_refs()` function

From
Patrick Steinhardt <ps@pks.im>
Date
Nov 14, 2023, 08:58 UTC
Message-ID
<cover.1699951815.git.ps@pks.im>
Hi,

this patch series refactors the virtual `delete_refs()` function to instead be implemented generically via a single reference transaction.

The main intent of this patch series is to reduce complexity that we have in the reference backends so that it becomes easier to implement new backends that have the same semantics as others. But at the same time, benchmarks show that the new generic code is even faster than the old backend-specific code. This is mostly because we avoid the overhead of per-reference transactions when deleting many references, but also because the transactional code in the files backend knows to avoid rewriting the packed-refs file in case it contains none of the refs that are to be deleted.

So in the end we have less duplicate code in the files backend, make it easier to implement new backends, and have faster deletion of many refs in the files backend.

Patrick
Patrick Steinhardt (4):
  t5510: ensure that the packed-refs file needs locking
  refs/files: use transactions to delete references
  refs: deduplicate code to delete references
  refs: remove `delete_refs` callback from backends
 refs.c                | 48 ++++++++++++++++++++++++++++++++++++++---
 refs/debug.c          | 15 -------------
 refs/files-backend.c  | 49 ------------------------------------------
 refs/packed-backend.c | 50 -------------------------------------------
 refs/refs-internal.h  |  3 ---
 t/t5510-fetch.sh      |  1 +
 6 files changed, 46 insertions(+), 120 deletions(-)
base-commit: e0939bec273052b1a8d69db4a3f7c87aaf83e220
-- 
2.42.0
Next: Patrick Steinhardt
Message 1 of 5 in “refs: remove virtual `delete_refs()` function”
  1. 0/4 refs: remove virtual `delete_refs()` functionPatrick Steinhardt, Nov 14, 2023
  2. 1/4 t5510: ensure that the packed-refs file needs lockingPatrick Steinhardt, Nov 14, 2023
  3. 2/4 refs/files: use transactions to delete referencesPatrick Steinhardt, Nov 14, 2023
  4. 3/4 refs: deduplicate code to delete referencesPatrick Steinhardt, Nov 14, 2023
  5. 4/4 refs: remove `delete_refs` callback from backendsPatrick Steinhardt, Nov 14, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.