From 98c6871fad0be42fbe045de2338d0a5bdbc5af1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Tue, 28 Jul 2020 23:40:38 +0200 Subject: [PATCH] grep: avoid using oid_to_hex() with parse_object_or_die() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit parse_object_or_die() is passed an object ID and a name to show if the object cannot be parsed. If the name is NULL then it shows the hexadecimal object ID. Use that feature instead of preparing and passing the hexadecimal representation to the function proactively. That's shorter and a bit more efficient. Signed-off-by: René Scharfe Signed-off-by: Junio C Hamano --- builtin/grep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/grep.c b/builtin/grep.c index a5056f395a..5975cf5ef2 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -466,7 +466,7 @@ static int grep_submodule(struct grep_opt *opt, struct strbuf base = STRBUF_INIT; obj_read_lock(); - object = parse_object_or_die(oid, oid_to_hex(oid)); + object = parse_object_or_die(oid, NULL); obj_read_unlock(); data = read_object_with_reference(&subrepo, &object->oid, tree_type,