Do not fail "describe --always" in a tag-less repository
authorJunio C Hamano <gitster@pobox.com>
Fri, 23 Oct 2009 18:42:39 +0000 (11:42 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 23 Oct 2009 19:00:41 +0000 (12:00 -0700)
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 <gitster@pobox.com>
builtin-describe.c
t/t6120-describe.sh
index df67a733ae5c91b0b4278c31c12a7432c0ec601e..7542b5705c4e0f3d214d3f3ff7367ee03bf82b9f 100644 (file)
@@ -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;
index 8c7e081c53eec31d38844d8efb9b942893107b09..f5a1b615f65ecac2becff67d47842e7aed3d6091 100755 (executable)
@@ -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) &&