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

Re: [PATCH 0/2] Slightly prettier reflog message from checkout

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
Jun 16, 2013, 09:21 UTC
Message-ID
<CALkWK0ki9C9OL36b3j14C-mVMPy07Uj5FXcrfMZJs_g3zBRC9A@mail.gmail.com>
In-Reply-To
<7vmwqqkftv.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
> I view the two codepaths touched by these patches the other way
> around.
I see.  Thanks for the early feedback.  I have some doubts.
Show 6 quoted lines
> An abbreviated unique SHA-1 you have today may not be unique
> tomorrow.  There is no reason to deliberately lose information
> (e.g. by using "Then, instead of the absolute minimum, let's record
> a bit more bytes" heuristics) when we record. The reflog recording
> code in checkout writes full 40-characters on purpose and there is
> no reason not to do so (i.e. the codepath that is the topic of 2/2).
When did we guarantee that the messages written by the reflog are invariant?
  $ git checkout @^
  $ git reflog | head -n 1
  b1d94f2 HEAD@{2 seconds ago}: checkout: moving from checkout-dash to HEAD^

What does HEAD^ even mean? What guarantees that checkout-dash will not be something else tomorrow? If you want invariance, isn't that what the first field is for (b1d94f2)? As I understand it, the messages are purely to convey end-user information about the breadcrumb trail: they were later made semi-semantic (like the @{-N} parser using them).

Show 7 quoted lines
> Once we accept that design principle of not losing information when
> we do not have to, it naturally follows that the writing side should
> write full 40-hex, and also the reading side (i.e. the codepath that
> is the topic of 1/2) should make sure that it reads 40-hex and
> nothing else.  This also reduces the risk of a funny branch name
> that consists only of [0-9a-f] getting mistaken as an object name,
> but that is not the primary point.

As I already explained, I don't know what information loss you're talking about. And yes, I noticed advice.object_name_warning.

> So I am fairly strongly negative on both changes.
Okay, but please explain it for me.
Previous: Junio C HamanoNext: Junio C Hamano
Message 9 of 10 in “Slightly prettier reflog message from checkout”
  1. 0/2 Slightly prettier reflog message from checkoutRamkumar Ramachandra, Jun 15, 2013
  2. 1/2 sha1_name: stop hard-coding 40-character hex checksRamkumar Ramachandra, Jun 15, 2013
  3. Phil HordJun 16, 2013
  4. Ramkumar RamachandraJun 18, 2013
  5. Junio C HamanoJun 18, 2013
  6. 2/2 checkout: do not write full sha1 to reflogRamkumar Ramachandra, Jun 15, 2013
  7. Ramkumar RamachandraJun 15, 2013
  8. Junio C HamanoJun 16, 2013
  9. Ramkumar RamachandraJun 16, 2013
  10. Junio C HamanoJun 17, 2013

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.