use parse_object_or_die instead of die("bad object")
[gitweb.git] / builtin / grep.c
index 8aea00c04840552d8d9912195609883ed0dc6bb2..08ea5fdec844604e6a48b9a5f6c7bbc74df651dc 100644 (file)
@@ -209,6 +209,7 @@ static void start_threads(struct grep_opt *opt)
                int err;
                struct grep_opt *o = grep_opt_dup(opt);
                o->output = strbuf_out;
+               o->debug = 0;
                compile_grep_patterns(o);
                err = pthread_create(&threads[i], NULL, run, o);
 
@@ -897,9 +898,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
                unsigned char sha1[20];
                /* Is it a rev? */
                if (!get_sha1(arg, sha1)) {
-                       struct object *object = parse_object(sha1);
-                       if (!object)
-                               die(_("bad object %s"), arg);
+                       struct object *object = parse_object_or_die(sha1, arg);
                        add_object_array(object, arg, &list);
                        continue;
                }
@@ -931,7 +930,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
        if (!seen_dashdash) {
                int j;
                for (j = i; j < argc; j++)
-                       verify_filename(prefix, argv[j]);
+                       verify_filename(prefix, argv[j], j == i);
        }
 
        paths = get_pathspec(prefix, argv + i);