diff options
author | Junio C Hamano <junkio@cox.net> | 2006-06-09 23:09:49 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-06-10 01:31:31 -0700 |
commit | 94df2506edd76a886a1044376f8c99349b2f226e (patch) | |
tree | 08bd44a53885e963bc6e7915c2e8c95df6db7d37 /builtin-init-db.c | |
parent | 5e3a620cd5f7baaf27198192a614271c6145ec3b (diff) | |
download | git-94df2506edd76a886a1044376f8c99349b2f226e.tar.gz |
shared repository: optionally allow reading to "others".
This enhances core.sharedrepository to have additionally
specify that read and exec permissions to be given to others as
well. It is useful when serving a repository via gitweb and
git-daemon that runs as a user outside the project group.
The configuration item can take the following values:
[core]
sharedrepository ; the same as "group"
sharedrepository = true ; ditto
sharedrepository = 1 ; ditto
sharedrepository = group ; allow rwx to group
sharedrepository = all ; allow rwx to group, allow rx to other
sharedrepository = umask ; not shared - use umask
It also extends "git init-db" to take "--shared=all" and friends
from the command line.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-init-db.c')
-rw-r--r-- | builtin-init-db.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/builtin-init-db.c b/builtin-init-db.c index 6a24e9bcab..7fdd2fa9f9 100644 --- a/builtin-init-db.c +++ b/builtin-init-db.c @@ -263,7 +263,9 @@ int cmd_init_db(int argc, const char **argv, char **envp) if (!strncmp(arg, "--template=", 11)) template_dir = arg+11; else if (!strcmp(arg, "--shared")) - shared_repository = 1; + shared_repository = PERM_GROUP; + else if (!strncmp(arg, "--shared=", 9)) + shared_repository = git_config_perm("arg", arg+9); else die(init_db_usage); } @@ -301,8 +303,15 @@ int cmd_init_db(int argc, const char **argv, char **envp) strcpy(path+len, "/info"); safe_create_dir(path, 1); - if (shared_repository) - git_config_set("core.sharedrepository", "true"); + if (shared_repository) { + char buf[10]; + /* We do not spell "group" and such, so that + * the configuration can be read by older version + * of git. + */ + sprintf(buf, "%d", shared_repository); + git_config_set("core.sharedrepository", buf); + } return 0; } |