Re: [PATCH 1/2] builtin/symbolic-ref.c: add option to fall back to normal ref

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

 



Jan Krüger <jk@xxxxx> writes:

> Frequently, people want to determine the current value of HEAD in
> scripts. However, there is no tool that can always output it, since "git
> symbolic-ref" will fail if HEAD isn't currently a symref, and other
> tools (e.g. "git rev-parse --symbolic-full-name") will also fail in
> one of HEAD's possible modes.

What is "the current value of HEAD"?

The symbolic-ref command is there for people who _care_ about the
distinction between a HEAD that points at a branch and a HEAD that points
directly at a commit.  There is no room for the command to "fall back"
anywhere, as that will only introduce an unnecessary ambiguity to the
command whose sole purpose is to be able to tell them apart.

If the caller does not need to know if the HEAD is detached or not, and
wants to know what commit it points at, why is it insufficient to just use
rev-parse, e.g. "git rev-parse --verify HEAD"?
--
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]