use parse_object_or_die instead of die("bad object")
Some call-sites do:
o = parse_object(sha1);
if (!o)
die("bad object %s", some_name);
We can now handle that as a one-liner, and get more
consistent output.
In the third case of this patch, it looks like we are losing
information, as the existing message also outputs the sha1
hex; however, parse_object will already have written a more
specific complaint about the sha1, so there is no point in
repeating it here.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
75a9549047
commit
f7892d1817
@ -898,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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user