Skip to content

refs.c: use transactions for the reflog

Stefan Beller git 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 7 repliesIn review
  2. v14 patches 0 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4refs.c: rename the transaction functionsbranch.c builtin/commit.c builtin/fetch.c +9 more+126 -1261 reply
2/4refs.c: rename transaction.updates to transaction.ref_updatesrefs.c+7 -71 reply
3/4refs.c: add a transaction function to append a reflog entryrefs.c refs.h+146 -23 replies
4/4reflog.c: use a reflog transaction when writing during expirebuiltin/reflog.c+37 -491 reply

Reviews trailers per patch

2 of 4 patches have a Reviewed-by or Acked-by.

PatchJonathan Nieder
1/4R-b
2/4R-b
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCHv2 0/4] refs.c: use transactions for the reflog

This is the core part of the refs-transactions-reflog series[1], which was in discussion for a bit already.

The idea is to have the reflog being part of the transactions, which the refs are already using, so the we're moving towards a database like API in the long run. This makes git easier to maintain as well as opening the possibility to replace the backend with a real database.

The first patch is essentially just some sed magic with reformatting the code, so the naming convention fits better, because the transactions will handle both the refs as well as the reflog after this series.

The second patch is also just a rename patch.

The meat and most of the lines of code are found in the 3rd patch. It was completely rewritten from scratch using ideas provided by Jonathan, thanks! We'll treat the refs and reflogs a bit differently within the transaction updates data structure, as the hard part for the refs is during the commit phase, while the hard part for the reflogs is during the preparation phase now.

We're using a temporary file for creating the new reflog and rename it into place afterwards utilizing the lock file API.

The last patch makes actually use of the reflog transaction API.

Any comments would be appreciated,
Thanks,
Stefan