Skip to content

Commit 40286ca

Browse files
avargitster
authored andcommitted
parse_object(): simplify blob conditional
Commit 8db2dad (parse_object(): check on-disk type of suspected blob, 2022-11-17) simplified the conditional for checking if we might have a blob. But we can simplify it further. In: !obj || (obj && obj->type == OBJ_BLOB) the short-circuit "OR" means "obj" will always be true on the right-hand side. The compiler almost certainly optimized that out anyway, but dropping it makes the conditional easier to understand for humans. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8db2dad commit 40286ca

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

object.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ struct object *parse_object_with_flags(struct repository *r,
286286
return &commit->object;
287287
}
288288

289-
if ((!obj || (obj && obj->type == OBJ_BLOB)) &&
289+
if ((!obj || obj->type == OBJ_BLOB) &&
290290
oid_object_info(r, oid, NULL) == OBJ_BLOB) {
291291
if (!skip_hash && stream_object_signature(r, repl) < 0) {
292292
error(_("hash mismatch %s"), oid_to_hex(oid));

0 commit comments

Comments
 (0)