aboutsummaryrefslogtreecommitdiff
path: root/builtin-describe.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin-describe.c')
-rw-r--r--builtin-describe.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/builtin-describe.c b/builtin-describe.c
index 7dbbee36a..390c14ec5 100644
--- a/builtin-describe.c
+++ b/builtin-describe.c
@@ -189,7 +189,6 @@ static void describe(const char *arg, int last_one)
unsigned char sha1[20];
struct commit *cmit, *gave_up_on = NULL;
struct commit_list *list;
- static int initialized = 0;
struct commit_name *n;
struct possible_tag all_matches[MAX_TAGS];
unsigned int match_cnt = 0, annotated_cnt = 0, cur_match;
@@ -201,14 +200,6 @@ static void describe(const char *arg, int last_one)
if (!cmit)
die("%s is not a valid '%s' object", arg, commit_type);
- if (!initialized) {
- initialized = 1;
- for_each_ref(get_name, NULL);
- }
-
- if (!found_names)
- die("cannot describe '%s'", sha1_to_hex(sha1));
-
n = cmit->util;
if (n) {
/*
@@ -378,6 +369,10 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
return cmd_name_rev(i + argc, args, prefix);
}
+ for_each_ref(get_name, NULL);
+ if (!found_names && !always)
+ die("No names found, cannot describe anything.");
+
if (argc == 0) {
if (dirty && !cmd_diff_index(ARRAY_SIZE(diff_index_args) - 1, diff_index_args, prefix))
dirty = NULL;