@matheusbsbs / matheus-bagliano / commits / 98c6871fad
Fork 0

grep: avoid using oid_to_hex() with parse_object_or_die()

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 <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

René Scharfe committed Jul 28, 2020 at 23:40 UTC 98c6871fad0be42fbe045de2338d0a5bdbc5af1d
1 file changed +1 -1
builtin/grep.c
+1 -1
@@ -466,7 +466,7 @@ static int grep_submodule(struct grep_opt *opt,
466 struct strbuf base = STRBUF_INIT;
467
468 obj_read_lock();
469 - object = parse_object_or_die(oid, oid_to_hex(oid));
469 + object = parse_object_or_die(oid, NULL);
470 obj_read_unlock();
471 data = read_object_with_reference(&subrepo,
472 &object->oid, tree_type,