Thread (7 messages) flat view 7 messages, 3 authors, 2016-06-15

Re: git-rev-parse --symbolic-abbrev-name

From: Arnaud Lacombe <hidden>
Date: 2016-06-15 22:45:52

Hi,

On Sun, Jan 4, 2009 at 2:36 PM, Junio C Hamano [off-list ref] wrote:
Karl Chen [off-list ref] writes:
quoted
... you really think "branchfoo" instead of
"refs/heads/branchfoo" is a narrow special case?
Of course it is narrower.  There are namespaces other than "heads" under
refs, and not everybody is interested in branches.
quoted
obviously all those people posting on blogs don't know about it :)
Yes, and that won't be helped by any new option to the plumbing.

The above two does not necessarily mean that it is useless to add a new
option to help a narrow special case that is common, though.
You'll find hereafter two patches which implements this in
git-symbolic-ref and git-rev-parse. Feel free to choose the one you
find the best. If you choose to integrate one of these, tells me and
I'll do a proper documentation bits and patch submission.

Sample output:

~/git/% ./git-rev-parse --symbolic-short-name HEAD
master
~/git/% ./git-symbolic-ref -a HEAD
master
~/git/% git checkout v1.6.1
~/git/% ./git-rev-parse --symbolic-short-name HEAD
HEAD
~/git/% ./git-symbolic-ref -a HEAD
fatal: ref HEAD is not a symbolic ref
~/git/% ./git-symbolic-ref -qa HEAD
~/git/%

Thanks in advance,

 - Arnaud

ps: I choose --symbolic-short-name as the opposite of
--symbolic-full-name for consistency.
ps2: sorry for the bogus mime-type

Attachments

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