Re: [PATCH] refspec: make @ a valid refspec

2 messages, 2 authors, 2020-11-24 · open the first message on its own page

Re: [PATCH] refspec: make @ a valid refspec

From: Junio C Hamano <hidden>
Date: 2020-11-24 20:01:31

Jeff King [off-list ref] writes:
I wondered if there was a good place to mention this in the refspec
documentation, but it may just be an obvious fallout of the "@ is a
shortcut for HEAD" definition in gitrevisions(7). The only change is
that we're resolving the shortcut sooner so that more code can take
advantage of it.
I too find that "@ is a shortcut for HEAD" looks ugly both at the UI
level and at the implementation level [*1*], but as long as we have
it, it is good to try to be consistent and allow "@" everywhere
where one would write "HEAD" in places where it is syntacitically
infeasible---at least we would be consistently ugly that way ;-).

The title of the change may want to be clarified to help readers of
"git shortlog".  It's not like it is only changing "@" and no other
variants valid refspec, but it forces readers to make sure that the
author did not forget to deal with ":@", "src:@", "@:dst", etc.
"make @ a synonym to HEAD in refspec" or something along the line,
perhaps.


[Footnote]

*1* I shouldn't complain too much, as my own invention to silently
turn "-" given from the command line into "@{-1}" is ugly at the
code level the same way, even though it may be better at the UI
level.

Re: [PATCH] refspec: make @ a valid refspec

From: Felipe Contreras <hidden>
Date: 2020-11-24 22:02:19

On Tue, Nov 24, 2020 at 2:01 PM Junio C Hamano [off-list ref] wrote:
Jeff King [off-list ref] writes:
quoted
I wondered if there was a good place to mention this in the refspec
documentation, but it may just be an obvious fallout of the "@ is a
shortcut for HEAD" definition in gitrevisions(7). The only change is
that we're resolving the shortcut sooner so that more code can take
advantage of it.
I too find that "@ is a shortcut for HEAD" looks ugly both at the UI
level and at the implementation level [*1*], but as long as we have
it, it is good to try to be consistent and allow "@" everywhere
where one would write "HEAD" in places where it is syntacitically
infeasible---at least we would be consistently ugly that way ;-).
Beauty is in the eye of the beholder.

I find HEAD to be an eyesore.
The title of the change may want to be clarified to help readers of
"git shortlog".  It's not like it is only changing "@" and no other
variants valid refspec, but it forces readers to make sure that the
author did not forget to deal with ":@", "src:@", "@:dst", etc.
"make @ a synonym to HEAD in refspec" or something along the line,
perhaps.
Right. I didn't notice it changed the semantics of those.

Given that, your suggested title makes more sense.

Cheers.

-- 
Felipe Contreras
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help