Thread (1 message) 1 message, 1 author, 2016-06-15

Re: Issue 356 in msysgit: 'git describe --always' doesn't work

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:47:36
Subsystem: the rest · Maintainer: Linus Torvalds

msysgit@googlecode.com writes:
Comment #1 on issue 356 by snaury: 'git describe --always' doesn't work
http://code.google.com/p/msysgit/issues/detail?id=356

This is not msysgit fault, the same happens on Mac OS X with
1.6.5.1. I  guess --always doesn't work anymore...
Thanks for noticing.  I think it is a regression in d68dc34 (git-describe:
Die early if there are no possible descriptions, 2009-08-06)

-- >8 --
Subject: [PATCH] Do not fail "describe --always" in a tag-less repository

This fixes a regression introduce by d68dc34 (git-describe: Die early if
there are no possible descriptions, 2009-08-06).

Signed-off-by: Junio C Hamano <redacted>
---
 builtin-describe.c  |    2 +-
 t/t6120-describe.sh |    2 ++
 2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/builtin-describe.c b/builtin-describe.c
index df67a73..7542b57 100644
--- a/builtin-describe.c
+++ b/builtin-describe.c
@@ -197,7 +197,7 @@ static void describe(const char *arg, int last_one)
 		for_each_ref(get_name, NULL);
 	}
 
-	if (!found_names)
+	if (!found_names && !always)
 		die("cannot describe '%s'", sha1_to_hex(sha1));
 
 	n = cmit->util;
diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh
index 8c7e081..f5a1b61 100755
--- a/t/t6120-describe.sh
+++ b/t/t6120-describe.sh
@@ -34,6 +34,8 @@ test_expect_success setup '
 	echo one >file && git add file && git commit -m initial &&
 	one=$(git rev-parse HEAD) &&
 
+	git describe --always HEAD &&
+
 	test_tick &&
 	echo two >file && git add file && git commit -m second &&
 	two=$(git rev-parse HEAD) &&
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help