From b383305a13d26b5050f8a5158d13cec72bdd1f24 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 24 Sep 2012 10:35:47 -0700 Subject: [PATCH] Revert "archive-zip: declare creator to be Unix for UTF-8 paths" This reverts commit 678770ac0cf556d27dc81d6ede976a135bdb9717, to replace it with a better alternative to make unzip pay attention to the general purpose flag 11 (encoding of paths). --- archive-zip.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/archive-zip.c b/archive-zip.c index e9b3dc99a5..0f763e8022 100644 --- a/archive-zip.c +++ b/archive-zip.c @@ -186,8 +186,7 @@ static int write_zip_entry(struct archiver_args *args, { struct zip_local_header header; struct zip_dir_header dirent; - unsigned int creator_version = 0; - unsigned long attr2 = 0; + unsigned long attr2; unsigned long compressed_size; unsigned long crc; unsigned long direntsize; @@ -225,15 +224,10 @@ static int write_zip_entry(struct archiver_args *args, enum object_type type = sha1_object_info(sha1, &size); method = 0; + attr2 = S_ISLNK(mode) ? ((mode | 0777) << 16) : + (mode & 0111) ? ((mode) << 16) : 0; if (S_ISREG(mode) && args->compression_level != 0 && size > 0) method = 8; - if (S_ISLNK(mode) || (mode & 0111) || (flags & ZIP_UTF8)) { - creator_version = 0x033f; - attr2 = mode; - if (S_ISLNK(mode)) - attr2 |= 0777; - attr2 <<= 16; - } compressed_size = size; if (S_ISREG(mode) && type == OBJ_BLOB && !args->convert && @@ -280,7 +274,8 @@ static int write_zip_entry(struct archiver_args *args, } copy_le32(dirent.magic, 0x02014b50); - copy_le16(dirent.creator_version, creator_version); + copy_le16(dirent.creator_version, + S_ISLNK(mode) || (S_ISREG(mode) && (mode & 0111)) ? 0x0317 : 0); copy_le16(dirent.version, 10); copy_le16(dirent.flags, flags); copy_le16(dirent.compression_method, method);