Revert "archive-zip: support UTF-8 paths"

This reverts commit 2162bd8cc461d6c3a12ab81c5db5a44bf5ecabc3; a two-patch series to replace it will follow.

Junio C Hamano committed Sep 18, 2012 at 13:32 UTC bb52d22ebbc6d8792d3a016e6e89fd6e39c7a39f
1 file changed +6 -21
archive-zip.c
+6 -21
@@ -4,8 +4,6 @@
4 #include "cache.h"
5 #include "archive.h"
6 #include "streaming.h"
7 -#include "commit.h"
8 -#include "utf8.h"
7
8 static int zip_date;
9 static int zip_time;
@@ -18,8 +16,7 @@ static unsigned int zip_dir_offset;
16 static unsigned int zip_dir_entries;
17
18 #define ZIP_DIRECTORY_MIN_SIZE (1024 * 1024)
21 -#define ZIP_STREAM (1 << 3)
22 -#define ZIP_UTF8 (1 << 11)
19 +#define ZIP_STREAM (8)
20
21 struct zip_local_header {
22 unsigned char magic[4];
@@ -176,8 +173,7 @@ static int write_zip_entry(struct archiver_args *args,
173 {
174 struct zip_local_header header;
175 struct zip_dir_header dirent;
179 - unsigned int creator_version = 0;
180 - unsigned long attr2 = 0;
176 + unsigned long attr2;
177 unsigned long compressed_size;
178 unsigned long crc;
179 unsigned long direntsize;
@@ -191,13 +187,6 @@ static int write_zip_entry(struct archiver_args *args,
187
188 crc = crc32(0, NULL, 0);
189
194 - if (has_non_ascii(path)) {
195 - if (is_utf8(path))
196 - flags |= ZIP_UTF8;
197 - else
198 - warning("Path is not valid UTF-8: %s", path);
199 - }
200 -
190 if (pathlen > 0xffff) {
191 return error("path too long (%d chars, SHA1: %s): %s",
192 (int)pathlen, sha1_to_hex(sha1), path);
@@ -215,15 +204,10 @@ static int write_zip_entry(struct archiver_args *args,
204 enum object_type type = sha1_object_info(sha1, &size);
205
206 method = 0;
207 + attr2 = S_ISLNK(mode) ? ((mode | 0777) << 16) :
208 + (mode & 0111) ? ((mode) << 16) : 0;
209 if (S_ISREG(mode) && args->compression_level != 0 && size > 0)
210 method = 8;
220 - if (S_ISLNK(mode) || (mode & 0111) || (flags & ZIP_UTF8)) {
221 - creator_version = 0x033f;
222 - attr2 = mode;
223 - if (S_ISLNK(mode))
224 - attr2 |= 0777;
225 - attr2 <<= 16;
226 - }
211 compressed_size = size;
212
213 if (S_ISREG(mode) && type == OBJ_BLOB && !args->convert &&
@@ -270,7 +254,8 @@ static int write_zip_entry(struct archiver_args *args,
254 }
255
256 copy_le32(dirent.magic, 0x02014b50);
273 - copy_le16(dirent.creator_version, creator_version);
257 + copy_le16(dirent.creator_version,
258 + S_ISLNK(mode) || (S_ISREG(mode) && (mode & 0111)) ? 0x0317 : 0);
259 copy_le16(dirent.version, 10);
260 copy_le16(dirent.flags, flags);
261 copy_le16(dirent.compression_method, method);