From ee213de22d15e801ba3712be0cb8ecbf7415fa1d Mon Sep 17 00:00:00 2001 From: Ævar Arnfjörð Bjarmason Date: Sat, 5 Feb 2022 00:48:29 +0100 Subject: object API users + docs: check <0, not !0 with check_object_signature() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change those users of the object API that misused check_object_signature() by assuming it returned any non-zero when the OID didn't match the expected value to check <0 instead. In practice all of this code worked before, but it wasn't consistent with rest of the users of the API. Let's also clarify what the <0 return value means in API docs. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- cache.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'cache.h') diff --git a/cache.h b/cache.h index 98d1ef0857..5d08195212 100644 --- a/cache.h +++ b/cache.h @@ -1324,6 +1324,9 @@ int parse_loose_header(const char *hdr, struct object_info *oi); * object name actually matches "oid" to detect object corruption. * With "buf" == NULL, try reading the object named with "oid" using * the streaming interface and rehash it to do the same. + * + * A negative value indicates an error, usually that the OID is not + * what we expected, but it might also indicate another error. */ int check_object_signature(struct repository *r, const struct object_id *oid, void *buf, unsigned long size, const char *type, -- cgit v1.3