parse_object(): simplify blob conditional
Commit 8db2dad7a0 (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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Nov 21, 2022 at 14:26 UTC
40286ca2fa1e08c386ea7bc6b76616a3cac63ffd
1 file changed
+1
-1
object.c
+1
-1
@@ -286,7 +286,7 @@ struct object *parse_object_with_flags(struct repository *r,
286
return &commit->object;
287
}
288
289
- if ((!obj || (obj && obj->type == OBJ_BLOB)) &&
289
+ if ((!obj || obj->type == OBJ_BLOB) &&
290
oid_object_info(r, oid, NULL) == OBJ_BLOB) {
291
if (!skip_hash && stream_object_signature(r, repl) < 0) {
292
error(_("hash mismatch %s"), oid_to_hex(oid));