]> git.ipfire.org Git - thirdparty/git.git/blobdiff - pack-check.c
Git 2.39.3
[thirdparty/git.git] / pack-check.c
index c8e560d71ab7e558da1a332d0640e6a71df5ac8c..bfb593ba7261a18a8283604f4e1cfdd10eb978f6 100644 (file)
@@ -127,7 +127,7 @@ static int verify_packfile(struct repository *r,
 
                if (type == OBJ_BLOB && big_file_threshold <= size) {
                        /*
-                        * Let check_object_signature() check it with
+                        * Let stream_object_signature() check it with
                         * the streaming interface; no point slurping
                         * the data in-core only to discard.
                         */
@@ -142,7 +142,11 @@ static int verify_packfile(struct repository *r,
                        err = error("cannot unpack %s from %s at offset %"PRIuMAX"",
                                    oid_to_hex(&oid), p->pack_name,
                                    (uintmax_t)entries[i].offset);
-               else if (check_object_signature(r, &oid, data, size, type_name(type)))
+               else if (data && check_object_signature(r, &oid, data, size,
+                                                       type) < 0)
+                       err = error("packed %s from %s is corrupt",
+                                   oid_to_hex(&oid), p->pack_name);
+               else if (!data && stream_object_signature(r, &oid) < 0)
                        err = error("packed %s from %s is corrupt",
                                    oid_to_hex(&oid), p->pack_name);
                else if (fn) {