From f7892d181752187513f10b13f2272fa46c9c8422 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Sun, 17 Mar 2013 04:23:31 -0400 Subject: 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 Signed-off-by: Junio C Hamano --- builtin/prune.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'builtin/prune.c') diff --git a/builtin/prune.c b/builtin/prune.c index 6cb99443c1..67ca3d5699 100644 --- a/builtin/prune.c +++ b/builtin/prune.c @@ -149,9 +149,7 @@ int cmd_prune(int argc, const char **argv, const char *prefix) const char *name = *argv++; if (!get_sha1(name, sha1)) { - struct object *object = parse_object(sha1); - if (!object) - die("bad object: %s", name); + struct object *object = parse_object_or_die(sha1, name); add_pending_object(&revs, object, ""); } else -- cgit v1.2.3