Skip to content

Commit

Permalink
preserve executable bits in zip archives
Browse files Browse the repository at this point in the history
Correct `git-archive --format=zip' command to preserve executable bits in
zip archives.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Dmitry Potapov authored and Junio C Hamano committed Sep 18, 2007
1 parent e349026 commit 76bf8d0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions archive-zip.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 76bf8d0

Please sign in to comment.