]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin-describe.c
MSVC: Add support for building with NO_MMAP
[thirdparty/git.git] / builtin-describe.c
index 63c6a19da5b38bc7c00c624c080ba0afbb10ff8a..df67a733ae5c91b0b4278c31c12a7432c0ec601e 100644 (file)
@@ -20,6 +20,7 @@ static int tags;      /* Allow lightweight tags */
 static int longformat;
 static int abbrev = DEFAULT_ABBREV;
 static int max_candidates = 10;
+static int found_names;
 static const char *pattern;
 static int always;
 
@@ -49,6 +50,7 @@ static void add_to_known_names(const char *path,
                memcpy(e->path, path, len);
                commit->util = e;
        }
+       found_names = 1;
 }
 
 static int get_name(const char *path, const unsigned char *sha1, int flag, void *cb_data)
@@ -195,6 +197,9 @@ static void describe(const char *arg, int last_one)
                for_each_ref(get_name, NULL);
        }
 
+       if (!found_names)
+               die("cannot describe '%s'", sha1_to_hex(sha1));
+
        n = cmit->util;
        if (n) {
                /*
@@ -322,7 +327,7 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
                OPT_END(),
        };
 
-       argc = parse_options(argc, argv, options, describe_usage, 0);
+       argc = parse_options(argc, argv, prefix, options, describe_usage, 0);
        if (max_candidates < 0)
                max_candidates = 0;
        else if (max_candidates > MAX_TAGS)