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

Re: [PATCH] revisions.txt: mention <rev>~ form

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 24, 2019, 01:05 UTC
Message-ID
<xmqqh8ao43gt.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<CACsJy8DB3k=9PaQT4CBz-K3=yjQ1oJAtz6p00PAOjy047XvAyA@mail.gmail.com>
Duy Nguyen <pclouds@gmail.com> writes:
Show 12 quoted lines
> On Mon, Apr 22, 2019 at 1:14 PM Denton Liu <liu.denton@gmail.com> wrote:
>>
>> In revisions.txt, the '<rev>^' form is mentioned but the '<rev>~' form
>> is missing. Although both forms are essentially equivalent (they each
>> get the first parent of the specified revision), we should mention the
>> latter for completeness. Make this change.
>
> Do we really support this, or is it a bug in rev parsing code that
> treats <rev>~ like <rev>~1?
>
> Hmm.. digging... ah 621ff67594 (rev-parse: fix meaning of rev~ vs
> rev~0., 2008-03-14) at least it's not an unintended bahaviour.
commit 621ff6759414e2a723f61b6d8fc04b9805eb0c20
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Fri Mar 14 11:49:40 2008 -0700
    rev-parse: fix meaning of rev~ vs rev~0.
    
    I think it would make more sense for rev~ to have the same guarantees that
    rev^ has, namely to always return a commit. I would also suggest that not
    giving a number would have the same effect of defaulting to 1, not 0.

Yes, I remember that one: if rev^ means rev^1, rev~ should mean rev~1, not rev or rev~0.

Previous: Duy NguyenNext: Andreas Heiduk
Message 6 of 16 in “revisions.txt: mention <rev>~ form”
  1. revisions.txt: mention <rev>~ formDenton Liu, Apr 22, 2019
  2. Junio C HamanoApr 22, 2019
  3. Denton LiuApr 22, 2019
  4. Junio C HamanoApr 22, 2019
  5. Duy NguyenApr 22, 2019
  6. Junio C HamanoApr 24, 2019
  7. Andreas HeidukApr 26, 2019
  8. Denton LiuApr 26, 2019
  9. 0/3 cleanup revisions.txtDenton Liu, Apr 27, 2019
  10. 1/3 revisions.txt: change "rev" to "<rev>"Denton Liu, Apr 27, 2019
  11. 2/3 revisions.txt: mark optional rev arguments with []Denton Liu, Apr 27, 2019
  12. Andreas HeidukMay 3, 2019
  13. Andreas HeidukMay 3, 2019
  14. 3/3 revisions.txt: mention <rev>~ formDenton Liu, Apr 27, 2019
  15. Andreas HeidukMay 3, 2019
  16. Denton LiuMay 3, 2019

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.