Code

Merge branch 'tr/describe-advice'
authorJunio C Hamano <gitster@pobox.com>
Tue, 10 Nov 2009 20:35:08 +0000 (12:35 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 10 Nov 2009 20:35:08 +0000 (12:35 -0800)
* tr/describe-advice:
  describe: when failing, tell the user about options that work

1  2 
builtin-describe.c

index 390c14ec5953447bc2458ba8cc39d35373fdeb51,504d9b120976e7d65d4a229b251e1a006c69e715..d4efb10ddfddedb1671fa91130e5fe78400ad154
@@@ -267,13 -257,17 +268,20 @@@ static void describe(const char *arg, i
        if (!match_cnt) {
                const unsigned char *sha1 = cmit->object.sha1;
                if (always) {
 -                      printf("%s\n", find_unique_abbrev(sha1, abbrev));
 +                      printf("%s", find_unique_abbrev(sha1, abbrev));
 +                      if (dirty)
 +                              printf("%s", dirty);
 +                      printf("\n");
                        return;
                }
-               die("cannot describe '%s'", sha1_to_hex(sha1));
+               if (unannotated_cnt)
+                       die("No annotated tags can describe '%s'.\n"
+                           "However, there were unannotated tags: try --tags.",
+                           sha1_to_hex(sha1));
+               else
+                       die("No tags can describe '%s'.\n"
+                           "Try --always, or create some tags.",
+                           sha1_to_hex(sha1));
        }
  
        qsort(all_matches, match_cnt, sizeof(all_matches[0]), compare_pt);