Subject: Re: [PATCH v13 04/13] reftable: file format documentation

From: Junio C Hamano <[email-masked]>
Date: Wed, 20 May 2020 10:33:25 -0700

Han-Wen Nienhuys <[email-masked]> writes:

> On Wed, May 20, 2020 at 7:20 PM Han-Wen Nienhuys <[email-masked]> wrote:
>> Jonathan Nieder said that this is used for git-stash, but I have never
>> understood why this is necessary, and would love to clarify this
>> better.
>
> The doc says this:
>
> "The `log_type = 0x0` is mostly useful for `git stash drop`, removing an
> entry from the reflog of `refs/stash` in a transaction file (below),
> without needing to rewrite larger files. Readers reading a stack of
> reflogs must treat this as a deletion."

Yup, I saw that and that is where my "I am guessing that log_type of
0x0 is *NOT* used for that purpose)." in my review comment came from.

The "git stash" itself is an abuse of the reflog mechanism, but its
"drop" subcommand is probably the worst offender.  It wants to remove
any arbitrary reflog entry in the middle of a reflog, not just topmost
ones (pop) or bottommost ones (expire).

> I should probably look at the code for git-stash to see how this plays out.