[PATCH] bisect: squelch "fatal: ref HEAD not a symref" misleading message

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

 



To get the current HEAD when we start bisecting using for example
"git bisect start", we first try "git symbolic-ref HEAD" to get a
nice name, and if it fails, we fall back to "git rev-parse
--verify HEAD".

The problem is that when "git symbolic-ref HEAD" fails, it
displays "fatal: ref HEAD not a symref", so it looks like "git
bisect start" failed and does not accept detached HEAD, even if
in fact it worked fine.

This patch adds "-q" option to the "git symbolic-ref" call to
get rid of the misleading error message.

Signed-off-by: Christian Couder <chriscool@xxxxxxxxxxxxx>
---
 git-bisect.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

	Junio C Hamano wrote:
	> Ingo Molnar <mingo@xxxxxxx> writes:
	> >  dione:~/linux-tmp4> git-bisect start
	> >  fatal: ref HEAD is not a symbolic ref
	> >  won't bisect on seeked tree
	> >
	> >  #
	> >  # Hm. It's not a symbolic ref, and git-bisect just wont do it.
	>
	> Enough people were unhappy with this historical wart and we stopped
	> refusing to "bisect on seeked tree" since b577bb9 (Eliminate confusing
	> "won't bisect on seeked tree" failure, 2008-02-23); you should find it as
	> part of the 1.5.5 release.
	>
	> The disturbing "fatal: ref HEAD not a symref" is still there even though
	> it should be harmless.  The message should be squelched.

	Here is a patch to do that.

diff --git a/git-bisect.sh b/git-bisect.sh
index 408775a..a36778d 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -66,7 +66,7 @@ bisect_start() {
 	# Verify HEAD. If we were bisecting before this, reset to the
 	# top-of-line master first!
 	#
-	head=$(GIT_DIR="$GIT_DIR" git symbolic-ref HEAD) ||
+	head=$(GIT_DIR="$GIT_DIR" git symbolic-ref -q HEAD) ||
 	head=$(GIT_DIR="$GIT_DIR" git rev-parse --verify HEAD) ||
 	die "Bad HEAD - I need a HEAD"
 	case "$head" in
-- 
1.5.5.52.g4aa8

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

  Powered by Linux