summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e349026)
raw | patch | inline | side by side (parent: e349026)
author | Dmitry Potapov <dpotapov@gmail.com> | |
Sun, 16 Sep 2007 17:07:38 +0000 (21:07 +0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 18 Sep 2007 21:56:55 +0000 (14:56 -0700) |
Correct `git-archive --format=zip' command to preserve executable bits in
zip archives.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
zip archives.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
archive-zip.c | patch | blob | history |
diff --git a/archive-zip.c b/archive-zip.c
index f63dff383483c482b414432b697306c53b320d00..74e30f6205f41112dc2bafe9371a790aca55f70c 100644 (file)
--- a/archive-zip.c
+++ b/archive-zip.c
compressed_size = 0;
} else if (S_ISREG(mode) || S_ISLNK(mode)) {
method = 0;
- attr2 = S_ISLNK(mode) ? ((mode | 0777) << 16) : 0;
+ attr2 = S_ISLNK(mode) ? ((mode | 0777) << 16) :
+ (mode & 0111) ? ((mode) << 16) : 0;
if (S_ISREG(mode) && zlib_compression_level != 0)
method = 8;
result = 0;
}
copy_le32(dirent.magic, 0x02014b50);
- copy_le16(dirent.creator_version, S_ISLNK(mode) ? 0x0317 : 0);
+ copy_le16(dirent.creator_version,
+ S_ISLNK(mode) || (S_ISREG(mode) && (mode & 0111)) ? 0x0317 : 0);
copy_le16(dirent.version, 10);
copy_le16(dirent.flags, 0);
copy_le16(dirent.compression_method, method);