Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-11-10 23:35:08 +0300
committerJunio C Hamano <gitster@pobox.com>2009-11-10 23:35:08 +0300
commit38d3d92c75561d1c0877cf06c501efe493ded924 (patch)
tree755ec3124bd6f771f3d846e5c37c3d878df814f8 /builtin-describe.c
parent92396402e2d547f8805dc24db53a4c725796810e (diff)
parent4d23660e79dbbb7e2ae37cb7193166d085a78502 (diff)
Merge branch 'tr/describe-advice'
* tr/describe-advice: describe: when failing, tell the user about options that work
Diffstat (limited to 'builtin-describe.c')
-rw-r--r--builtin-describe.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/builtin-describe.c b/builtin-describe.c
index 390c14ec59..d4efb10ddf 100644
--- a/builtin-describe.c
+++ b/builtin-describe.c
@@ -105,8 +105,6 @@ static int get_name(const char *path, const unsigned char *sha1, int flag, void
if (!all) {
if (!prio)
return 0;
- if (!tags && prio < 2)
- return 0;
}
add_to_known_names(all ? path + 5 : path + 10, commit, prio, sha1);
return 0;
@@ -193,6 +191,7 @@ static void describe(const char *arg, int last_one)
struct possible_tag all_matches[MAX_TAGS];
unsigned int match_cnt = 0, annotated_cnt = 0, cur_match;
unsigned long seen_commits = 0;
+ unsigned int unannotated_cnt = 0;
if (get_sha1(arg, sha1))
die("Not a valid object name %s", arg);
@@ -228,7 +227,9 @@ static void describe(const char *arg, int last_one)
seen_commits++;
n = c->util;
if (n) {
- if (match_cnt < max_candidates) {
+ if (!tags && !all && n->prio < 2) {
+ unannotated_cnt++;
+ } else if (match_cnt < max_candidates) {
struct possible_tag *t = &all_matches[match_cnt++];
t->name = n;
t->depth = seen_commits - 1;
@@ -273,7 +274,14 @@ static void describe(const char *arg, int last_one)
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);