summaryrefslogtreecommitdiff
path: root/archive-zip.c
diff options
context:
space:
mode:
authorDmitry Potapov <dpotapov@gmail.com>2007-09-16 17:07:38 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-09-18 21:56:55 (GMT)
commit76bf8d0e0ad0840395471fd862bd2cdad095345d (patch)
tree8906e69e0d0342bc103a89bb28245df53ccea62a /archive-zip.c
parente3490268120946cfae737ab3a884b082e962209d (diff)
downloadgit-76bf8d0e0ad0840395471fd862bd2cdad095345d.zip
git-76bf8d0e0ad0840395471fd862bd2cdad095345d.tar.gz
git-76bf8d0e0ad0840395471fd862bd2cdad095345d.tar.bz2
preserve executable bits in zip archives
Correct `git-archive --format=zip' command to preserve executable bits in zip archives. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'archive-zip.c')
-rw-r--r--archive-zip.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/archive-zip.c b/archive-zip.c
index f63dff3..74e30f6 100644
--- a/archive-zip.c
+++ b/archive-zip.c
@@ -192,7 +192,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;
@@ -231,7 +232,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);