Re: [RFC PATCH] revision: new rev%n shorthand for rev^n..rev
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 23, 2016, 16:43 UTC
- Message-ID
- <xmqqr38a1s8u.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20160923105254.10235-1-vegard.nossum@oracle.com>
Vegard Nossum <vegard.nossum@oracle.com> writes:
> I use rev^..rev daily, and I'm surely not the only one. To save typing > (or copy-pasting, if the rev is long -- like a full SHA-1 or branch name) > we can make rev% a shorthand for that.
No, we cannot.
'%' is not reserved as a special character that is forbidden in reference names, and for somebody who has a branch whose name is 'master%', such a change will suddenly make 'master%' mean something completely different, breaking existing users' repositories.
This is why existing rev^@ and rev^! both use the "^" as the first character that introduces the "magic" semantics; "^" cannot be a part of a refname. Also sequences that begin with "^{" and "@{" are reserved as escape hatches to allow us extend the revision syntax in the future ("^{" works on history, while "@{" bases its working on the reflog data).
As "rev^$n" is "nth parent", it may be a possibility to use "rev^-$n" as a short-hand for "^rev^$n rev".