* [PATCH] preserve executable bits in zip archives
@ 2007-09-16 17:07 Dmitry Potapov
0 siblings, 0 replies; only message in thread
From: Dmitry Potapov @ 2007-09-16 17:07 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: text/plain, Size: 1122 bytes --]
Correct `git-archive --format=zip' command to preserve executable bits in
zip archives.
---
archive-zip.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/archive-zip.c b/archive-zip.c
index 444e162..5f9b7e6 100644
--- a/archive-zip.c
+++ b/archive-zip.c
@@ -191,7 +191,8 @@ static int write_zip_entry(const unsigned char *sha1,
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;
@@ -229,7 +230,8 @@ static int write_zip_entry(const unsigned char *sha1,
}
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);
--
1.5.3.1
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2007-09-16 17:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-16 17:07 [PATCH] preserve executable bits in zip archives Dmitry Potapov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.