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

Re: git symbolic-ref vs. reflog (vs. rebase)

From
Jeff King <peff@peff.net>
Date
Apr 30, 2011, 03:58 UTC
Message-ID
<20110430035819.GA4673@sigill.intra.peff.net>
In-Reply-To
<7vk4ecvf2c.fsf@alter.siamese.dyndns.org>
On Fri, Apr 29, 2011 at 04:00:11PM -0700, Junio C Hamano wrote:
Show 9 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > I think every caller should be using "-m" these days.  I know we can't
> > _require_ it for historical reasons. But shouldn't symbolic-ref always
> > write a reflog entry? Even something like "we changed and I can't tell
> > you why" to cover older scripts that call symbolic-ref?
> 
> I think the particular instance Csaba saw in rebase may want to pass the
> reason why it flipped the HEAD.

Oh, definitely. I was thinking more for external scripts that we can't fix.

Show 5 quoted lines
> Flipping HEAD temporarily to another ref to do something, only to flip it
> back before giving the control back to the user, might be something a
> script may want to have a choice of not logging, so I am mildly negative
> on changing the command to unconditionally log empty entry without being
> told.

Yeah, that is a legitimate use case. But I suspect many scripts were simply never updated after reflogs were introduced (or their authors) were lazy, so they flip it once without a reflog, and then the next well-behaved writer who comes along ends up writing a reflog entry that shows a hole.

So it is a question of whether helping probably-broken users is worth shutting off a legitimate use case. I also wonder how valuable that use case is. As a user, I think I'd rather see _everything_ in the reflog, even if the script-writer doesn't think it's important.

I don't know that it matters much in any case. We haven't had any bug reports either way; and given the current behavior, one can always yell at the script author to properly reflog.

> "update-ref" seems to write an empty entry even when not given an "-m"
> option, and we can view it as robbing a similar choice from the scripts.
> We might want to fix it.  I dunno.

I'm inclined to wait until somebody actually wants it. In the meantime it helps users of old and/or broken scripts by providing an additional checkpoint of state that might otherwise be missing.

-Peff
Previous: Junio C HamanoNext: Csaba Henk
Message 10 of 11 in “git symbolic-ref vs. reflog (vs. rebase)”
  1. Csaba HenkApr 29, 2011
  2. Junio C HamanoApr 29, 2011
  3. Csaba HenkApr 29, 2011
  4. Jeff KingApr 30, 2011
  5. Csaba HenkMay 2, 2011
  6. 1/2 rebase: create HEAD reflog entry when abortingJeff King, May 27, 2011
  7. 2/2 rebase: write a reflog entry when finishingJeff King, May 27, 2011
  8. Jeff KingApr 29, 2011
  9. Junio C HamanoApr 29, 2011
  10. Jeff KingApr 30, 2011
  11. Csaba HenkMay 2, 2011

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.