Skip to content

Write multi-ref updates directly to packed refs

Ronnie Sahlberg git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2refs.c: write updates to packed refs when a transaction has more than one refbuiltin/clone.c refs.c+66 -242 replies
2/2refs.c: make the *_packed_refs functions staticrefs.c refs.h+4 -320 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] Write multi-ref updates directly to packed refs

This patch adds support to the transaction system to update all non-refs as packed refs instead of loose refs.

This series can also be found at
https://github.com/rsahlberg/git/tree/ref-transactions-req-packed-refs

This series adds support to have transaction write updates to packed refs instead of as loose refs.
If the transaction only contains a single update to a single ref, such as the commit case, we continue to update this as locking and writing to the loose ref file.
But If on the other hand the transaction will update more than one ref, then we perform all these updates inside the packed refs file and remove all the affected loose refs files. This allows us to both perform deletes (added previously) as well as updates-of-more-than-one-ref as one single atomic rename operation.

Since the transactions will now by default write directly to the packed refs file for updates to more than one ref, we no longer need to provide a pacekd refs api to builtin/clone.c any more. So lets change clone.c to use a transaction. This removes 4 fucntions from the refs.c API we can now unexport and make static.

This change means that clone will now apear as one single atomic operation to any external observer where all refs appear at once instead of one ref becoming visible at a time.

Ronnie Sahlberg (2):
refs.c: write updates to packed refs when a transaction has more than
one ref
refs.c: make the *_packed_refs functions static

 builtin/clone.c | 16 ++++++++---
 refs.c          | 82 ++++++++++++++++++++++++++++++++++++++++-----------------
 refs.h          | 28 --------------------
 3 files changed, 70 insertions(+), 56 deletions(-)
Signature · 1 line
2.0.0.583.g402232d