diff options
author | Junio C Hamano <junkio@cox.net> | 2006-06-10 01:31:58 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-06-10 01:31:58 -0700 |
commit | 67d4160712ef07bc7a5bc6790f166ba39d45a82a (patch) | |
tree | e4204935d23f0df97b493086ed6fb9eb29ad378e /path.c | |
parent | 55becd7b5fdbd93a2928a659a670d004d30d7c37 (diff) | |
parent | 94df2506edd76a886a1044376f8c99349b2f226e (diff) | |
download | git-67d4160712ef07bc7a5bc6790f166ba39d45a82a.tar.gz |
Merge branch 'jc/shared' into next
* jc/shared:
shared repository: optionally allow reading to "others".
git-clone: fix --bare over dumb-http
shared repository - add a few missing calls to adjust_shared_perm().
Fix formatting of Documentation/git-clone.txt
builtin-init-db: spell the in-program configuration variable in lowercase.
Diffstat (limited to 'path.c')
-rw-r--r-- | path.c | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -250,3 +250,36 @@ char *enter_repo(char *path, int strict) return NULL; } + +int adjust_shared_perm(const char *path) +{ + struct stat st; + int mode; + + if (!shared_repository) + return 0; + if (lstat(path, &st) < 0) + return -1; + mode = st.st_mode; + if (mode & S_IRUSR) + 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 |= (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) + return -2; + return 0; +} |