Re: [PATCH] Add new @ shortcut for HEAD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/30/2013 07:54 AM, Duy Nguyen wrote:
> On Tue, Apr 30, 2013 at 2:35 AM, Felipe Contreras
> <felipe.contreras@xxxxxxxxx> wrote:
>> So we can type '@' instead of 'HEAD@', or rather 'HEAD'. So now we can
>> use 'git show @~1', and all that goody goodness.
> 
> I like this. I haven't spent a lot of time on thinking about
> ambiguation. But I think we're safe there. '@' is not overloaded much
> like ':', '^' or '~'.
> 
>> This patch allows 'HEAD@' to be the same as 'HEAD@{0}', and similarly with
>> 'master@'.
> 
> I'm a bit reluctant to this. It looks like incomplete syntax to me as
> '@' has always been followed by '{'. Can we have the lone '@' candy
> but reject master@ and HEAD@? There's no actual gain in writing
> master@ vs master@{0}.

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.

This is not to say that the rule can't be changed and/or that the
git-svn use of such tag names conflicts with the proposed new syntax.
But it can definitely not be excluded that the new pattern will be
ambiguous with refnames that are already in use "in the wild".

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 :-)

Michael

-- 
Michael Haggerty
mhagger@xxxxxxxxxxxx
http://softwareswirl.blogspot.com/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]