summaryrefslogtreecommitdiff
path: root/tar-tree.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-10-01 19:01:07 (GMT)
committerJunio C Hamano <junkio@cox.net>2005-10-02 06:14:06 (GMT)
commit38ec15a973a1f075f0d94d130b0ef279562921cd (patch)
tree66b5560d248a6234040a147ce017fd1013519e60 /tar-tree.c
parentf8d839ad992d92e1e31d7a557c198371d1fb7692 (diff)
downloadgit-38ec15a973a1f075f0d94d130b0ef279562921cd.zip
git-38ec15a973a1f075f0d94d130b0ef279562921cd.tar.gz
git-38ec15a973a1f075f0d94d130b0ef279562921cd.tar.bz2
Honor extractor's umask in git-tar-tree.
The archive generated with git-tar-tree had 0755 and 0644 mode bits. This inconvenienced the extractor with umask 002 by robbing g+w bit unconditionally. Just write it out with loose permissions bits and let the umask of the extractor do its job. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'tar-tree.c')
-rw-r--r--tar-tree.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tar-tree.c b/tar-tree.c
index 2716ae3..970c4bb 100644
--- a/tar-tree.c
+++ b/tar-tree.c
@@ -353,6 +353,8 @@ static void traverse_tree(void *buffer, unsigned long size,
if (size < namelen + 20 || sscanf(buffer, "%o", &mode) != 1)
die("corrupt 'tree' file");
+ if (S_ISDIR(mode) || S_ISREG(mode))
+ mode |= (mode & 0100) ? 0777 : 0666;
buffer = sha1 + 20;
size -= namelen + 20;