revert(3p/git): Revert merge of git upstream at v2.26.2

This causes cgit to serve error pages, which is undesirable.

This reverts commit 5229c9b232, reversing
changes made to f2b211131f.
This commit is contained in:
Vincent Ambo 2020-05-26 00:06:52 +01:00
parent 6f8fbf4aa4
commit 93ba78d6f4
1006 changed files with 60537 additions and 148724 deletions

View file

@ -24,11 +24,6 @@ static unsigned int max_creator_version;
#define ZIP_STREAM (1 << 3)
#define ZIP_UTF8 (1 << 11)
enum zip_method {
ZIP_METHOD_STORE = 0,
ZIP_METHOD_DEFLATE = 8
};
struct zip_local_header {
unsigned char magic[4];
unsigned char version[2];
@ -296,7 +291,7 @@ static int write_zip_entry(struct archiver_args *args,
unsigned long attr2;
unsigned long compressed_size;
unsigned long crc;
enum zip_method method;
int method;
unsigned char *out;
void *deflated = NULL;
void *buffer;
@ -325,7 +320,7 @@ static int write_zip_entry(struct archiver_args *args,
}
if (S_ISDIR(mode) || S_ISGITLINK(mode)) {
method = ZIP_METHOD_STORE;
method = 0;
attr2 = 16;
out = NULL;
size = 0;
@ -335,18 +330,17 @@ static int write_zip_entry(struct archiver_args *args,
enum object_type type = oid_object_info(args->repo, oid,
&size);
method = ZIP_METHOD_STORE;
method = 0;
attr2 = S_ISLNK(mode) ? ((mode | 0777) << 16) :
(mode & 0111) ? ((mode) << 16) : 0;
if (S_ISLNK(mode) || (mode & 0111))
creator_version = 0x0317;
if (S_ISREG(mode) && args->compression_level != 0 && size > 0)
method = ZIP_METHOD_DEFLATE;
method = 8;
if (S_ISREG(mode) && type == OBJ_BLOB && !args->convert &&
size > big_file_threshold) {
stream = open_istream(args->repo, oid, &type, &size,
NULL);
stream = open_istream(oid, &type, &size, NULL);
if (!stream)
return error(_("cannot stream blob %s"),
oid_to_hex(oid));
@ -364,7 +358,7 @@ static int write_zip_entry(struct archiver_args *args,
buffer, size);
out = buffer;
}
compressed_size = (method == ZIP_METHOD_STORE) ? size : 0;
compressed_size = (method == 0) ? size : 0;
} else {
return error(_("unsupported file mode: 0%o (SHA1: %s)"), mode,
oid_to_hex(oid));
@ -373,13 +367,13 @@ static int write_zip_entry(struct archiver_args *args,
if (creator_version > max_creator_version)
max_creator_version = creator_version;
if (buffer && method == ZIP_METHOD_DEFLATE) {
if (buffer && method == 8) {
out = deflated = zlib_deflate_raw(buffer, size,
args->compression_level,
&compressed_size);
if (!out || compressed_size >= size) {
out = buffer;
method = ZIP_METHOD_STORE;
method = 0;
compressed_size = size;
}
}
@ -426,7 +420,7 @@ static int write_zip_entry(struct archiver_args *args,
zip_offset += ZIP64_EXTRA_SIZE;
}
if (stream && method == ZIP_METHOD_STORE) {
if (stream && method == 0) {
unsigned char buf[STREAM_BUFFER_SIZE];
ssize_t readlen;
@ -449,7 +443,7 @@ static int write_zip_entry(struct archiver_args *args,
zip_offset += compressed_size;
write_zip_data_desc(size, compressed_size, crc);
} else if (stream && method == ZIP_METHOD_DEFLATE) {
} else if (stream && method == 8) {
unsigned char buf[STREAM_BUFFER_SIZE];
ssize_t readlen;
git_zstream zstream;
@ -609,18 +603,18 @@ static void write_zip_trailer(const struct object_id *oid)
static void dos_time(timestamp_t *timestamp, int *dos_date, int *dos_time)
{
time_t time;
struct tm tm;
struct tm *t;
if (date_overflows(*timestamp))
die(_("timestamp too large for this system: %"PRItime),
*timestamp);
time = (time_t)*timestamp;
localtime_r(&time, &tm);
t = localtime(&time);
*timestamp = time;
*dos_date = tm.tm_mday + (tm.tm_mon + 1) * 32 +
(tm.tm_year + 1900 - 1980) * 512;
*dos_time = tm.tm_sec / 2 + tm.tm_min * 32 + tm.tm_hour * 2048;
*dos_date = t->tm_mday + (t->tm_mon + 1) * 32 +
(t->tm_year + 1900 - 1980) * 512;
*dos_time = t->tm_sec / 2 + t->tm_min * 32 + t->tm_hour * 2048;
}
static int archive_zip_config(const char *var, const char *value, void *data)