summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2022-11-21 19:26:55 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-11-22 01:13:54 (GMT)
commit40286ca2fa1e08c386ea7bc6b76616a3cac63ffd (patch)
treece8f4f6cdab16cff74902780d997f5625a5ad226 /object.c
parent8db2dad7a045e376b9c4f51ddd33da43c962e3a4 (diff)
downloadgit-40286ca2fa1e08c386ea7bc6b76616a3cac63ffd.zip
git-40286ca2fa1e08c386ea7bc6b76616a3cac63ffd.tar.gz
git-40286ca2fa1e08c386ea7bc6b76616a3cac63ffd.tar.bz2
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>
Diffstat (limited to 'object.c')
-rw-r--r--object.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/object.c b/object.c
index fad1a5a..682b852 100644
--- a/object.c
+++ b/object.c
@@ -286,7 +286,7 @@ struct object *parse_object_with_flags(struct repository *r,
return &commit->object;
}
- if ((!obj || (obj && obj->type == OBJ_BLOB)) &&
+ if ((!obj || obj->type == OBJ_BLOB) &&
oid_object_info(r, oid, NULL) == OBJ_BLOB) {
if (!skip_hash && stream_object_signature(r, repl) < 0) {
error(_("hash mismatch %s"), oid_to_hex(oid));