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

Re: Should notes handle replace commits?

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 9, 2016, 01:04 UTC
Message-ID
<xmqqmvsfzhq4.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20160109002510.GA30050@glandium.org>
Mike Hommey <mh@glandium.org> writes:
> So while `cat-file commit A` gives you what `cat-file commit Z` would,
> `notes show A` doesn't give you what `notes show Z` would. And that's
> this "inconsistency" that bothers me.

In any case, 'notes' being a way to add extra information to an existing object means that with your original "replace" that tells Git to keep A in the history (and give Z's contents when contents of A was asked), it is absolutely correct that notes for A is shown. It would make no sense if notes for Z "followed", because as long as Git is concerned, you told Git to show A when your "git log master" followed the history down thru B to its parent, which you did not rewrite to be Z but kept to be A. With the approach to replace B with B' that has Z as its parent, when "git log master" follows the history down thru C to its parent, Git thinks it is showing B but reads B', and finds out its parent is Z and goes down to Z, and notes for these two commits B and Z (not B' and Z) would be shown; there is no need to "follow".

The true source of your confusion, I think, is that there is a misunderstanding of what "replace A with Z" does.

It is not "whenever somebody refers to A, pretend as if it is referring to Z". If that _were_ the case, then I'd agree that "whenever somebody else asks notes attached to A, pretend as if notes attached to Z were asked" might make sense, but that does not match the reality.

It is not graft vs replace. It is about what you replace with what other thing: "replace" is a content replacement mechanism, not identity replacement mechanism.

Previous: Mike HommeyNext: Mike Hommey
Message 8 of 12 in “Should notes handle replace commits?”
  1. Mike HommeyJan 8, 2016
  2. Junio C HamanoJan 8, 2016
  3. Mike HommeyJan 8, 2016
  4. Junio C HamanoJan 8, 2016
  5. Junio C HamanoJan 9, 2016
  6. Mike HommeyJan 9, 2016
  7. Mike HommeyJan 9, 2016
  8. Junio C HamanoJan 9, 2016
  9. Mike HommeyJan 9, 2016
  10. Junio C HamanoJan 11, 2016
  11. Philip OakleyJan 9, 2016
  12. Junio C HamanoJan 11, 2016

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.