On Wed, Apr 21, 2021 at 8:39 AM Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> wrote: > > In reftable, there is no notion of a per-ref 'existence' of a reflog. Each > > reflog entry has its own key, so it is not possible to distinguish between > > {reflog doesn't exist,reflog exists but is empty}. This makes the logic > > in log_ref_setup() (file refs/files-backend.c), which depends on the existence > > of the reflog file infeasible. > > Okey, so I'd follow this if the test was doing something like "test -e > .git/logs" to test whether we didn't have reflogs for a specific branch > or something.... > .. > In your v7[1] of the reftable series there's no patch to > Documentation/revisions.txt altering that blurb. > > So it seems to me that between this & that series there's some closing > of the gap needed with how this "must have an existing log" even works > under reftable. the problem is that it's using BRANCH@{0} as a way to indicate whether the reflog exists or not, and something looks at the current tip of BRANCH for @{0} even if the reflog is empty: hanwen@hanwen1:~/vc/git$ ls -l .git/logs/refs/heads/windows-2 -rw-r----- 1 hanwen primarygroup 0 Apr 29 20:08 .git/logs/refs/heads/windows-2 hanwen@hanwen1:~/vc/git$ git rev-parse windows-2@{0} 7048e02d79350e332f34f2bfae50eb28700cbeda hanwen@hanwen1:~/vc/git$ rm .git/logs/refs/heads/windows-2 hanwen@hanwen1:~/vc/git$ git rev-parse windows-2@{0} windows-2@{0} fatal: ambiguous argument 'windows-2@{0}': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]' in reftable, with the current implementation, all reflogs are assumed to exist (but possibly empty). > Per [2] I had assumed that this worked under reftable by abstracting > away the syntax to some query for the ref name, and faking up "file does > not exist" as "there were no records" to anything like rev-parse, but it > doesn't work like that? you could make it work like that, but I bet that then there are a host of other tests that fail because they might check that a reflog exists (but is empty) after doing eg. "git reflog expire --all". -- 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