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

Re: [PATCH 2/4] name-rev: allow converting the exact object name at the tip of a ref

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 8, 2013, 15:12 UTC
Message-ID
<7v38rp2ihg.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CALkWK0kSqaMrD_YuT8OxLo8yLEc0APd2Ca7FapKstqqmcYbC7A@mail.gmail.com>
Ramkumar Ramachandra <artagnon@gmail.com> writes:
>   Finds symbolic names suitable for human digestion for revisions
>   given in any format parsable by git rev-parse.
>
> It is meant to name _revisions_ (aka. commits):

That is a mistaken documentation, written based on a half-baked implementation that conflated "the current code only can handle commits" with "we need to only handle commit and nothing, ever".

We had to fix a similar misguided/short-sighted implementation in the "git fetch" codepath when adding "git pull/merge $tag" (the code peeled a tag object too early when writing FETCH_HEAD out, losing information if what we were given was a tag or a commit).

I do not want to see us making the mistake worse unnecessarily. When we see a commit object that is pointed by tag v1.8.3, it is the right thing to do to return v1.8.3^0 as its string representation so that "git rev-parse v1.8.3^0" give us the same thing back. name-rev that is fed a tag object v1.8.3 should give v1.8.3 (not v1.8.3^0) back, otherwise feeding its output to "git rev-parse" will not give us the same thing we fed as the input to name-rev.

Previous: Ramkumar RamachandraNext: Junio C Hamano
Message 7 of 20 in “Make "git name-rev $(git rev-parse v1.8.3)" work”
  1. 0/4 Make "git name-rev $(git rev-parse v1.8.3)" workJunio C Hamano, Jul 7, 2013
  2. 1/4 name-ref: factor out name shortening logic from name_ref()Junio C Hamano, Jul 7, 2013
  3. Michael HaggertyJul 8, 2013
  4. Junio C HamanoJul 8, 2013
  5. 2/4 name-rev: allow converting the exact object name at the tip of a refJunio C Hamano, Jul 7, 2013
  6. Ramkumar RamachandraJul 8, 2013
  7. Junio C HamanoJul 8, 2013
  8. 3/4 describe: use argv-arrayJunio C Hamano, Jul 7, 2013
  9. Jeff KingJul 9, 2013
  10. Junio C HamanoJul 9, 2013
  11. Junio C HamanoJul 9, 2013
  12. Jeff KingJul 9, 2013
  13. 4/4 describe/name-rev: tell name-rev to peel the incoming object to commit firstJunio C Hamano, Jul 7, 2013
  14. Ramkumar RamachandraJul 8, 2013
  15. Jeff KingJul 9, 2013
  16. Jeff KingJul 9, 2013
  17. Junio C HamanoJul 9, 2013
  18. Jeff KingJul 9, 2013
  19. Junio C HamanoJul 9, 2013
  20. Ramkumar RamachandraJul 9, 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.