Hi, On Tue, 20 Dec 2005, Junio C Hamano wrote: > [shell] > umask = 0002 If you don't use git-shell, because the same machine is used for other purposes, it makes sense to introduce [core] umask = 0002 How about this: --- [PATCH] Introduce core.umask This makes it possible to setup a shared git repository by setting [core] umask = 0002 int the template config file. This patch makes sure even git-init-db uses it. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> --- init-db.c | 21 ++++++++++++++------- setup.c | 4 ++++ 2 files changed, 18 insertions(+), 7 deletions(-) faa7d4b101211ac1993d73bb3d02e8a6d2c40734 diff --git a/init-db.c b/init-db.c index 41576bd..26812ce 100644 --- a/init-db.c +++ b/init-db.c @@ -164,6 +164,7 @@ static void create_default_files(const c unsigned char sha1[20]; struct stat st1; char repo_version_string[10]; + mode_t mask, mask2; if (len > sizeof(path)-50) die("insane git directory %s", git_dir); @@ -172,6 +173,19 @@ static void create_default_files(const c if (len && path[len-1] != '/') path[len++] = '/'; + /* First copy the templates -- we might have the default + * config file there, in which case we would want to read + * from it after installing. + * The config file may contain a umask... + */ + path[len] = 0; + umask(mask = umask(0)); + copy_templates(path, len, template_path); + if (mask != (mask2 = umask(mask))) { + umask(mask2); + chmod(path, 0777 & ~mask2); + } + /* * Create .git/refs/{heads,tags} */ @@ -182,13 +196,6 @@ static void create_default_files(const c strcpy(path + len, "refs/tags"); safe_create_dir(path); - /* First copy the templates -- we might have the default - * config file there, in which case we would want to read - * from it after installing. - */ - path[len] = 0; - copy_templates(path, len, template_path); - git_config(git_default_config); /* diff --git a/setup.c b/setup.c index d3556ed..4e4cb46 100644 --- a/setup.c +++ b/setup.c @@ -180,6 +180,10 @@ int check_repository_format_version(cons { if (strcmp(var, "core.repositoryformatversion") == 0) repository_format_version = git_config_int(var, value); + + else if (!strcmp(var, "core.umask")) + umask(git_config_int(var, value)); + return 0; } -- 1.0.0 - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.htmlReceived on Thu Dec 22 02:38:17 2005
This archive was generated by hypermail 2.1.8 : 2005-12-22 02:38:24 EST