summaryrefslogtreecommitdiff
path: root/path.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-06-18 20:19:09 -0700
committerJunio C Hamano <junkio@cox.net>2006-06-18 20:19:09 -0700
commitd9faecac641ab31c7bfe5008f5a6dca119b79bc7 (patch)
treee132b0d810e00c6ea2bb4ea5c8a4597ff4cb0e2a /path.c
parent72afd3eea6758a5ef181eaa3eef0b21639177494 (diff)
parent94df2506edd76a886a1044376f8c99349b2f226e (diff)
downloadgit-d9faecac641ab31c7bfe5008f5a6dca119b79bc7.tar.gz
Merge branch 'jc/shared'
* jc/shared: shared repository: optionally allow reading to "others".
Diffstat (limited to 'path.c')
-rw-r--r--path.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/path.c b/path.c
index 194e0b553f..36972fd6df 100644
--- a/path.c
+++ b/path.c
@@ -267,11 +267,21 @@ int adjust_shared_perm(const char *path)
return -1;
mode = st.st_mode;
if (mode & S_IRUSR)
- mode |= S_IRGRP;
+ mode |= (shared_repository == PERM_GROUP
+ ? S_IRGRP
+ : (shared_repository == PERM_EVERYBODY
+ ? (S_IRGRP|S_IROTH)
+ : 0));
+
if (mode & S_IWUSR)
mode |= S_IWGRP;
+
if (mode & S_IXUSR)
- mode |= S_IXGRP;
+ mode |= (shared_repository == PERM_GROUP
+ ? S_IXGRP
+ : (shared_repository == PERM_EVERYBODY
+ ? (S_IXGRP|S_IXOTH)
+ : 0));
if (S_ISDIR(mode))
mode |= S_ISGID;
if (chmod(path, mode) < 0)