X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-init-db.c;h=52473edf569e4d318a74548acefaf4023f37c87c;hb=0881d2d1303a067a02e3811d43a1aed04a47945e;hp=2a1384ccb0b5a54f94057f9eac58ed449aac2fc5;hpb=7fb23e6083dbefa8eb4c554d8b2cd5a6292b2df4;p=git.git diff --git a/builtin-init-db.c b/builtin-init-db.c index 2a1384ccb..52473edf5 100644 --- a/builtin-init-db.c +++ b/builtin-init-db.c @@ -198,6 +198,21 @@ static void create_default_files(const char *git_dir, const char *template_path) git_config(git_default_config); + /* + * We would have created the above under user's umask -- under + * shared-repository settings, we would need to fix them up. + */ + if (shared_repository) { + path[len] = 0; + adjust_shared_perm(path); + strcpy(path + len, "refs"); + adjust_shared_perm(path); + strcpy(path + len, "refs/heads"); + adjust_shared_perm(path); + strcpy(path + len, "refs/tags"); + adjust_shared_perm(path); + } + /* * Create the default symlink from ".git/HEAD" to the "master" * branch, if it does not exist yet. @@ -235,7 +250,7 @@ static const char init_db_usage[] = * On the other hand, it might just make lookup slower and messier. You * be the judge. The default case is to have one DB per managed directory. */ -int cmd_init_db(int argc, const char **argv, char **envp) +int cmd_init_db(int argc, const char **argv, const char *prefix) { const char *git_dir; const char *sha1_dir; @@ -248,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); } @@ -286,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; }