Re: [PATCH] revisions.txt: mention <rev>~ form
- Date: Wed, 24 Apr 2019 10:05:54 +0900
- From: Junio C Hamano <gitster@xxxxxxxxx>
- Subject: Re: [PATCH] revisions.txt: mention <rev>~ form
Duy Nguyen <pclouds@xxxxxxxxx> writes:
> On Mon, Apr 22, 2019 at 1:14 PM Denton Liu <liu.denton@xxxxxxxxx> 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.
Author: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
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.