Merge branch 'jc/strbuf-branchname-fix'
[gitweb.git] / builtin / grep.c
index 0e1b6c860e18c6c47f343fad885cbd24f641862e..159e65d47a41b56634bc3fb480f9c051d40e692c 100644 (file)
@@ -820,9 +820,9 @@ 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);
+                       if (!seen_dashdash)
+                               verify_non_filename(prefix, arg);
                        add_object_array(object, arg, &list);
                        continue;
                }