preserve executable bits in zip archives
PATCH 1/1 preserve executable bits in zip archives
Correct `git-archive --format=zip' command to preserve executable bits in zip archives.
--- archive-zip.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
archive-zip.c +4 -2
@@ -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);
Signature · 1 line
1.5.3.1