git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Han-Wen Nienhuys <hanwen@google.com>
Cc: git <git@vger.kernel.org>
Subject: Re: reflog existence & reftable
Date: Wed, 21 Apr 2021 13:57:09 +0200	[thread overview]
Message-ID: <87im4f3l62.fsf@evledraar.gmail.com> (raw)
In-Reply-To: <CAFQ2z_Ps3YxycA+NJ9VKt_PEXb+m83JdNB7ujzWw1fTPKyZ=fg@mail.gmail.com>


On Wed, Apr 21 2021, Han-Wen Nienhuys wrote:

> Hi there,
>
> (splitting off from a code review of my test cleanups.)

Just changing the "Subject" won't break In-Reply-To and prune CC, FWIW
the missing In-Reply-To is (probably):
https://lore.kernel.org/git/87pmyo3zvw.fsf@evledraar.gmail.com/

> 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?

I think we should fix the tests first, per [1] :)

Because there's a third case revealed by the test case, which would be
teased out by not entirely skipping the test with REFFILES, but
incrementally splitting it up:

Which is that the current reftable implementation is failing a test
(well, probably a lot more, but the one under discussion) that:

 A. Sets core.logAllRefUpdates=false
 B. Checks out an orphan branch
 C. Checks that it has no existing reflog
 D. Makes a commit there
 E. Checks that it has no reflog

Only the "E" case is covered by your summary above.

But no matter how reftable's behavior is under
core.logAllRefUpdates=false it should surely not be returning true in
the "C" case, because there's no log entry to serve up, and indeed the
branch being asked for has no commits.

So for that case somewhere in the guts of the reftable integration we're
losing the distinction between asking for a log that can't exist
v.s. one that's empty, maybe the reftable code is returning "yes I have
logging on" or "yes I have some entries somewhere" in that case?

And in "E", related to "C" isn't in unambiguous to not write it if
there's no existing entry for the branch in question and
core.logAllRefUpdates=false is in effect?

For the rest of this is the behavior under reftable indistinguishable
from having core.logAllRefUpdates=always set?

In any case, I don't think the emergent behavior of the files backend is
worth emulating, but maybe if some feel that way it might be better to
transition the setting in general to core.logAllRefUpdates being a
global on/off boolean, and having a branch.<name>.logRefUpdates, but I
suspect that there's not going to be any/many users of this selective
logging feature.

1. https://lore.kernel.org/git/87lf9b3mth.fsf@evledraar.gmail.com/

  reply	other threads:[~2021-04-21 11:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-21 10:02 reflog existence & reftable Han-Wen Nienhuys
2021-04-21 11:57 ` Ævar Arnfjörð Bjarmason [this message]
2021-04-21 16:55   ` Junio C Hamano
2021-04-23  9:20     ` Han-Wen Nienhuys
2021-04-23 14:07       ` Jeff King
2021-04-26 17:33         ` Han-Wen Nienhuys
2021-04-27  6:52           ` Junio C Hamano

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=87im4f3l62.fsf@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=hanwen@google.com \
    /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;
as well as URLs for NNTP newsgroup(s).