Skip to content

Commit 98c6871

Browse files
rscharfegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b3d7a52 commit 98c6871

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

builtin/grep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ static int grep_submodule(struct grep_opt *opt,
466466
struct strbuf base = STRBUF_INIT;
467467

468468
obj_read_lock();
469-
object = parse_object_or_die(oid, oid_to_hex(oid));
469+
object = parse_object_or_die(oid, NULL);
470470
obj_read_unlock();
471471
data = read_object_with_reference(&subrepo,
472472
&object->oid, tree_type,

0 commit comments

Comments
 (0)