Re: [PATCH] Add new @ shortcut for HEAD
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Apr 30, 2013, 10:12 UTC
- Message-ID
- <CACsJy8ATWBuvqmjon7-s9KfPcWGHPUFbd6gHR2CqaOwHAgWZrg@mail.gmail.com>
- In-Reply-To
- <517F6E40.1040606@alum.mit.edu>
On Tue, Apr 30, 2013 at 2:09 PM, Michael Haggerty <mhagger@alum.mit.edu> wrote:
Show 5 quoted lines
> According to git-check-ref-format(1), an "@" character is currently
> legal in a reference name as long as it is not followed by "{". As an
> example, git-svn uses "@" in reference names (e.g.,
> "refs/remotes/svn/tags/foo@56945"), I believe when a Subversion branch
> or tag is deleted then re-created.Thanks! I was looking for this document but couldn't remember its name.
Show 6 quoted lines
> Amusingly, it is already possible to define a reference or symbolic > reference named "@". So all that you need to do is type > > git symbolic-ref -m "Create @ alias for HEAD" @ HEAD > > to get the shortcut that you want :-)
Not so amusingly (and off topic), why reading the code this patch touches, I think if we have a ref whose last component is exactly 40 chars and contains only [0-9a-fA-F], then we simply consider it sha-1 and return without reading the ref. -- Duy