Code

Fix "grep -w"
[git.git] / describe.c
index ff65742615cb6862d3699e4f301d671a7eadc2e2..324ca8965b9512de59b515cdcc29801022553d1d 100644 (file)
@@ -67,7 +67,7 @@ static int get_name(const char *path, const unsigned char *sha1)
         * Otherwise only annotated tags are used.
         */
        if (!strncmp(path, "refs/tags/", 10)) {
-               if (object->type == tag_type)
+               if (object->type == OBJ_TAG)
                        prio = 2;
                else
                        prio = 1;
@@ -97,7 +97,7 @@ static int compare_names(const void *_a, const void *_b)
        return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1;
 }
 
-static void describe(char *arg, int last_one)
+static void describe(const char *arg, int last_one)
 {
        unsigned char sha1[20];
        struct commit *cmit;
@@ -105,11 +105,11 @@ static void describe(char *arg, int last_one)
        static int initialized = 0;
        struct commit_name *n;
 
-       if (get_sha1(arg, sha1) < 0)
-               usage(describe_usage);
+       if (get_sha1(arg, sha1))
+               die("Not a valid object name %s", arg);
        cmit = lookup_commit_reference(sha1);
        if (!cmit)
-               usage(describe_usage);
+               die("%s is not a valid '%s' object", arg, commit_type);
 
        if (!initialized) {
                initialized = 1;