revert(3p/git): Revert merge of git upstream at v2.26.2
This causes cgit to serve error pages, which is undesirable. This reverts commit5229c9b232, reversing changes made tof2b211131f.
This commit is contained in:
parent
6f8fbf4aa4
commit
93ba78d6f4
1006 changed files with 60537 additions and 148724 deletions
32
third_party/git/pack-check.c
vendored
32
third_party/git/pack-check.c
vendored
|
|
@ -8,6 +8,10 @@
|
|||
|
||||
struct idx_entry {
|
||||
off_t offset;
|
||||
union idx_entry_object {
|
||||
const unsigned char *hash;
|
||||
struct object_id *oid;
|
||||
} oid;
|
||||
unsigned int nr;
|
||||
};
|
||||
|
||||
|
|
@ -63,23 +67,23 @@ static int verify_packfile(struct repository *r,
|
|||
if (!is_pack_valid(p))
|
||||
return error("packfile %s cannot be accessed", p->pack_name);
|
||||
|
||||
r->hash_algo->init_fn(&ctx);
|
||||
the_hash_algo->init_fn(&ctx);
|
||||
do {
|
||||
unsigned long remaining;
|
||||
unsigned char *in = use_pack(p, w_curs, offset, &remaining);
|
||||
offset += remaining;
|
||||
if (!pack_sig_ofs)
|
||||
pack_sig_ofs = p->pack_size - r->hash_algo->rawsz;
|
||||
pack_sig_ofs = p->pack_size - the_hash_algo->rawsz;
|
||||
if (offset > pack_sig_ofs)
|
||||
remaining -= (unsigned int)(offset - pack_sig_ofs);
|
||||
r->hash_algo->update_fn(&ctx, in, remaining);
|
||||
the_hash_algo->update_fn(&ctx, in, remaining);
|
||||
} while (offset < pack_sig_ofs);
|
||||
r->hash_algo->final_fn(hash, &ctx);
|
||||
the_hash_algo->final_fn(hash, &ctx);
|
||||
pack_sig = use_pack(p, w_curs, pack_sig_ofs, NULL);
|
||||
if (!hasheq(hash, pack_sig))
|
||||
err = error("%s pack checksum mismatch",
|
||||
p->pack_name);
|
||||
if (!hasheq(index_base + index_size - r->hash_algo->hexsz, pack_sig))
|
||||
if (!hasheq(index_base + index_size - the_hash_algo->hexsz, pack_sig))
|
||||
err = error("%s pack checksum does not match its index",
|
||||
p->pack_name);
|
||||
unuse_pack(w_curs);
|
||||
|
|
@ -93,6 +97,9 @@ static int verify_packfile(struct repository *r,
|
|||
entries[nr_objects].offset = pack_sig_ofs;
|
||||
/* first sort entries by pack offset, since unpacking them is more efficient that way */
|
||||
for (i = 0; i < nr_objects; i++) {
|
||||
entries[i].oid.hash = nth_packed_object_sha1(p, i);
|
||||
if (!entries[i].oid.hash)
|
||||
die("internal error pack-check nth-packed-object");
|
||||
entries[i].offset = nth_packed_object_offset(p, i);
|
||||
entries[i].nr = i;
|
||||
}
|
||||
|
|
@ -100,16 +107,11 @@ static int verify_packfile(struct repository *r,
|
|||
|
||||
for (i = 0; i < nr_objects; i++) {
|
||||
void *data;
|
||||
struct object_id oid;
|
||||
enum object_type type;
|
||||
unsigned long size;
|
||||
off_t curpos;
|
||||
int data_valid;
|
||||
|
||||
if (nth_packed_object_id(&oid, p, entries[i].nr) < 0)
|
||||
BUG("unable to get oid of object %lu from %s",
|
||||
(unsigned long)entries[i].nr, p->pack_name);
|
||||
|
||||
if (p->index_version > 1) {
|
||||
off_t offset = entries[i].offset;
|
||||
off_t len = entries[i+1].offset - offset;
|
||||
|
|
@ -117,7 +119,7 @@ static int verify_packfile(struct repository *r,
|
|||
if (check_pack_crc(p, w_curs, offset, len, nr))
|
||||
err = error("index CRC mismatch for object %s "
|
||||
"from %s at offset %"PRIuMAX"",
|
||||
oid_to_hex(&oid),
|
||||
oid_to_hex(entries[i].oid.oid),
|
||||
p->pack_name, (uintmax_t)offset);
|
||||
}
|
||||
|
||||
|
|
@ -140,14 +142,14 @@ static int verify_packfile(struct repository *r,
|
|||
|
||||
if (data_valid && !data)
|
||||
err = error("cannot unpack %s from %s at offset %"PRIuMAX"",
|
||||
oid_to_hex(&oid), p->pack_name,
|
||||
oid_to_hex(entries[i].oid.oid), p->pack_name,
|
||||
(uintmax_t)entries[i].offset);
|
||||
else if (check_object_signature(r, &oid, data, size, type_name(type)))
|
||||
else if (check_object_signature(entries[i].oid.oid, data, size, type_name(type)))
|
||||
err = error("packed %s from %s is corrupt",
|
||||
oid_to_hex(&oid), p->pack_name);
|
||||
oid_to_hex(entries[i].oid.oid), p->pack_name);
|
||||
else if (fn) {
|
||||
int eaten = 0;
|
||||
err |= fn(&oid, type, size, data, &eaten);
|
||||
err |= fn(entries[i].oid.oid, type, size, data, &eaten);
|
||||
if (eaten)
|
||||
data = NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue