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

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".

Previous: Vegard Nossum
Message 2 of 2 in “revision: new rev%n shorthand for rev^n..rev”
  1. revision: new rev%n shorthand for rev^n..revVegard Nossum, Sep 23, 2016
  2. Junio C HamanoSep 23, 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.