From: Junio C Hamano <gitster@pobox.com>
To: "Jan Krüger" <jk@jk.gs>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/2] builtin/symbolic-ref.c: add option to fall back to normal ref
Date: Mon, 27 Feb 2012 14:21:26 -0800 [thread overview]
Message-ID: <7v1upf6hp5.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1330380536-9647-1-git-send-email-jk@jk.gs> ("Jan Krüger"'s message of "Mon, 27 Feb 2012 23:08:56 +0100")
Jan Krüger <jk@jk.gs> 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"?
next prev parent reply other threads:[~2012-02-27 22:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-27 22:08 [PATCH 1/2] builtin/symbolic-ref.c: add option to fall back to normal ref Jan Krüger
2012-02-27 22:21 ` Junio C Hamano [this message]
2012-02-27 22:40 ` Jan Krüger
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=7v1upf6hp5.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=jk@jk.gs \
/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).