From: Felipe Contreras <felipe.contreras@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Duy Nguyen <pclouds@gmail.com>,
Git Mailing List <git@vger.kernel.org>,
Ramkumar Ramachandra <artagnon@gmail.com>,
Michael J Gruber <git@drmicha.warpmail.net>,
Jon Seymour <jon.seymour@gmail.com>
Subject: Re: [PATCH] Add new @ shortcut for HEAD
Date: Tue, 30 Apr 2013 17:17:48 -0500 [thread overview]
Message-ID: <CAMP44s2S4AtZUfH4NWCLt=p49QXeYSZKELYbahpBUgDofaFMsw@mail.gmail.com> (raw)
In-Reply-To: <7vhaindcuk.fsf@alter.siamese.dyndns.org>
On Tue, Apr 30, 2013 at 2:42 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Duy Nguyen <pclouds@gmail.com> writes:
>>
>>> On Tue, Apr 30, 2013 at 2:35 AM, Felipe Contreras
>>> <felipe.contreras@gmail.com> 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}.
>>
>> Originally I was going to say the same, but after thinking about it
>> a bit more, I changed my mind.
>
> Let me change my mind once again ;-)
>
> As @ has been a valid character in a ref, I think "git show master@"
> and "git show HEAD@" _should_ error out, not because they suffix
> 'master' and 'HEAD" in a funny way, but simply because there is no
> branch called 'master@' (i.e. 'git for-each-ref | grep master@'
> yields empty). After you run "git branch master@ master~26", you
> should see "git show master@" not to error out, because that is just
> the name of a branch with somewhat an unusual name.
There is also no branch named master@{0}. And there are no branches
with @{ in them, because we forbid them. So the question is what do we
want to forbid? If we don't want to forbid 'master@', then sure
'master@' should not evaluate to 'master'.
> And we can still have "git show @" to do "git show HEAD", based on a
> world model completely different from I (incorrectly) advocated in
> the message I am replying to.
>
> The rule would be "You should be able to say '@' where-ever you
> currently say HEAD" (aka '@' is a short-hand for 'HEAD').
>
> That means "git checout @" should work the same way as "git checkout
> HEAD", "git log @~4" would work the same way as "git log HEAD~4",
> "git update-ref @ $(git rev-parse master)" should update the HEAD
> without creating $GIT_DIR/@, etc.
>
> You can't go any simpler than that rule, and there is no room for
> confusion if that rule is properly implemented.
I disagree. I can do 'git log @{-1}-4', but I cannot do 'git
update-ref @{-1}'. Why? Because the '@' notation is for revision
parsing, and 'git update-ref' doesn't do revision parsing.
I'd say, everywhere where you could do @{-1}, you should be able to do @.
Cheers.
--
Felipe Contreras
next prev parent reply other threads:[~2013-04-30 22:17 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-29 19:35 [PATCH] Add new @ shortcut for HEAD Felipe Contreras
2013-04-29 19:43 ` Ramkumar Ramachandra
2013-04-29 20:01 ` Junio C Hamano
2013-04-29 20:14 ` Felipe Contreras
2013-04-29 20:24 ` Junio C Hamano
2013-04-29 20:38 ` Felipe Contreras
2013-04-29 21:01 ` Junio C Hamano
2013-04-29 20:02 ` Junio C Hamano
2013-04-29 20:23 ` Felipe Contreras
2013-04-29 21:36 ` Felipe Contreras
2013-04-29 22:50 ` Junio C Hamano
2013-04-30 0:53 ` Jonathan Nieder
2013-04-30 17:54 ` Junio C Hamano
2013-04-30 18:17 ` Felipe Contreras
2013-04-29 22:38 ` Junio C Hamano
2013-04-29 22:49 ` Felipe Contreras
2013-04-29 23:06 ` Junio C Hamano
2013-04-29 23:10 ` Felipe Contreras
2013-04-30 5:54 ` Duy Nguyen
2013-04-30 6:10 ` Felipe Contreras
2013-04-30 6:17 ` Duy Nguyen
2013-04-30 6:20 ` Felipe Contreras
2013-04-30 6:30 ` Duy Nguyen
2013-04-30 7:55 ` Felipe Contreras
2013-04-30 7:09 ` Michael Haggerty
2013-04-30 7:35 ` Ramkumar Ramachandra
2013-04-30 10:16 ` Duy Nguyen
2013-04-30 11:10 ` Ramkumar Ramachandra
2013-04-30 18:54 ` Ramkumar Ramachandra
2013-04-30 10:12 ` Duy Nguyen
2013-04-30 17:22 ` Junio C Hamano
2013-04-30 17:37 ` Ramkumar Ramachandra
2013-04-30 17:40 ` Ramkumar Ramachandra
2013-04-30 17:56 ` Junio C Hamano
2013-04-30 18:04 ` Ramkumar Ramachandra
2013-04-30 18:20 ` Felipe Contreras
2013-04-30 18:45 ` Ramkumar Ramachandra
2013-04-30 22:08 ` Felipe Contreras
2013-04-30 17:47 ` Felipe Contreras
2013-04-30 17:56 ` Jeff King
2013-04-30 18:18 ` Felipe Contreras
2013-04-30 19:42 ` Junio C Hamano
2013-04-30 19:53 ` Ramkumar Ramachandra
2013-04-30 20:05 ` Junio C Hamano
2013-04-30 20:37 ` Ramkumar Ramachandra
2013-04-30 19:59 ` Junio C Hamano
2013-04-30 22:17 ` Felipe Contreras [this message]
2013-04-30 22:27 ` Junio C Hamano
2013-04-30 22:38 ` Felipe Contreras
2013-04-30 22:42 ` Junio C Hamano
2013-04-30 22:53 ` Felipe Contreras
2013-04-30 23:00 ` Felipe Contreras
2013-04-30 23:19 ` Felipe Contreras
2013-04-30 23:24 ` Junio C Hamano
2013-04-30 6:07 ` Duy Nguyen
2013-04-30 6:11 ` Felipe Contreras
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAMP44s2S4AtZUfH4NWCLt=p49QXeYSZKELYbahpBUgDofaFMsw@mail.gmail.com' \
--to=felipe.contreras@gmail.com \
--cc=artagnon@gmail.com \
--cc=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jon.seymour@gmail.com \
--cc=pclouds@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).