git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Keep reflogs for deleted (remote tracking) branches?

From
Tao Klerks <tao@klerks.biz>
Date
Mar 14, 2022, 12:10 UTC
Message-ID
<CAPMMpohNi4LhyQm+WYfmRRVZ_B2YfoqeRzWRusza6VUwkJUOWg@mail.gmail.com>
In-Reply-To
<220314.86y21cerhe.gmgdl@evledraar.gmail.com>

On Mon, Mar 14, 2022 at 11:52 AM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:

Show 9 quoted lines
>
> I think you might find it interesting to have pre-receive hooks
> e.g. reject pushes if you're deleting a topic whose commits aren't
> entirely <your author> i.e. just something like:
>
>     git push -o ireallymeanit=1 --delete topic
>
> I.e. it's an easy to implement extra safety check that people can always
> opt-out of, print a scary message and most people will think twice :)

That is indeed very interesting, thanks! I need to think about exactly when this is the right thing to do, but it's a tool in the box that I was not aware of!

Show 27 quoted lines
> > My question is specifically about the, in my opinion, very surprising
> > behavior of deleting reflogs along with deleted branches - I mainly
> > provided the example use-case for context.
>
> Yes it's quite a mess, e.g. if you follow the rabit hole at the
> recent[1].
>
> One fundimental problem (discussed in various places around the reftable
> backend) is that we carry N meanings for an empty reflog:
>
> A. "This is an active branch, but we have expired the entries".
>
> B. "I manually created this, knowing that the various core.* configs
>    around reflog will say "oh, a reflog exists, let's log to it" (in
>    some cases).
>
> C. Another is: This is "stale" log, i.e. no branch exists, but the log
>    is there.
>
> Which is one reason[2] we'd delete them on branch deletion, because
> otherwise we'd start logging again when a branch is re-created, which
> possibly isn't what we wanted.
>
> 1. https://lore.kernel.org/git/de5e2b0e290791d0a4f58a893d8571b5fc8c4f1a.1646952843.git.avarab@gmail.com
> 2. I'm not saying this was intended, and haven't looked into this case,
>    just that's it it's an emergent effect of how these files are treated
>    now.

Very interesting, thx. Fwiw I would argue that resuming full logging when a new branch appears with the same name (within the period of time where the reflog is not empty yet) is a very reasonable thing to end up doing, but I guess Han-Wen's note about potential path conflicts on branches *after* a deletion make this a hard thing to change, even if "accidental logging resuming" were accepted as a sensible outcome here.

Previous: Ævar Arnfjörð BjarmasonNext: Jeff Hostetler
Message 6 of 8 in “Keep reflogs for deleted (remote tracking) branches?”
  1. Tao KlerksMar 8, 2022
  2. Han-Wen NienhuysMar 8, 2022
  3. Ævar Arnfjörð BjarmasonMar 8, 2022
  4. Tao KlerksMar 14, 2022
  5. Ævar Arnfjörð BjarmasonMar 14, 2022
  6. Tao KlerksMar 14, 2022
  7. Jeff HostetlerMar 8, 2022
  8. Tao KlerksMar 14, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.