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

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

 



Hi,

On Sun, Jan 4, 2009 at 2:36 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Karl Chen <quarl@xxxxxxxxxxxxxxx> writes:
>
>> ... 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.
>
>> 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

Attachment: git-rev-parse_symbolic-short-name.diff
Description: Binary data

Attachment: git-symbolic-refs_abbrev-name.diff
Description: Binary data


[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]

  Powered by Linux