reflog existence & reftable
- From
Han-Wen Nienhuys <hanwen@google.com>
- Date
- Apr 21, 2021, 10:02 UTC
- Message-ID
- <CAFQ2z_Ps3YxycA+NJ9VKt_PEXb+m83JdNB7ujzWw1fTPKyZ=fg@mail.gmail.com>
Hi there,
(splitting off from a code review of my test cleanups.)
Currently, reflogs are stored in .git/log/*. Git adds entries to the reflog only if the reflog already exists (See the log_ref_setup() function).
The current iteration of the reftable design has a unified key space of {refname,index-number} for reflog entries. This causes there to be no distinction between
1) reflog is empty (.git/logs/blah is a 0-byte file) 2) reflog does not exist (.git/logs/blah does not exist)
This trips up some current tests that make assumptions on reflog existence.
I don't know why one can tweak reflog to be written or not, but the current functionality will cause a change in operation with reftable. I see two ways forward:
1) Have different functionality in case of reftable: you cannot query for the existence of reflogs, and writing reflogs doesn't depend on the existence of a reflog.
2) Add a reflog existence feature to reftable. We could introduce a magical reflog entry, which indicates that the reflog exists (but might be empty). This adds some complexity to the C code, but lets us maintain backward compatibility.
What do you think?
-- Han-Wen Nienhuys - Google Munich I work 80%. Don't expect answers from me on Fridays. -- Google Germany GmbH, Erika-Mann-Strasse 33, 80636 Munich Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschäftsführer: Paul Manicle, Halimah DeLaine Prado