summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-05-12 21:31:09 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-05-12 21:32:25 (GMT)
commit6a616619679d78e116f775a37094c15e1f824775 (patch)
treefc1423625c5697811dc8bcac13037e7c37d576ea
parente54793a95afeea1e10de1e5ad7eab914e7416250 (diff)
downloadgit-6a616619679d78e116f775a37094c15e1f824775.zip
git-6a616619679d78e116f775a37094c15e1f824775.tar.gz
git-6a616619679d78e116f775a37094c15e1f824775.tar.bz2
archive: do not let on-disk mode leak to zip archives
When the "--add-file" option is used to add the contents from an untracked file to the archive, the permission mode bits for these files are sent to the archive-backend specific "write_entry()" method as-is. We normalize the mode bits for tracked files way before we pass them to the write_entry() method; we should do the same here. This is not strictly needed for "tar" archive-backend, as it has its own code to further clean them up, but "zip" archive-backend is not so well prepared. Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--archive.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/archive.c b/archive.c
index e29d0e0..12a08af 100644
--- a/archive.c
+++ b/archive.c
@@ -342,7 +342,7 @@ int write_archive_entries(struct archiver_args *args,
else
err = write_entry(args, &fake_oid, path_in_archive.buf,
path_in_archive.len,
- info->stat.st_mode,
+ canon_mode(info->stat.st_mode),
content.buf, content.len);
if (err)
break;