summaryrefslogtreecommitdiff
path: root/builtin-init-db.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-04-06 00:42:52 -0700
committerJunio C Hamano <gitster@pobox.com>2009-04-06 00:42:52 -0700
commit03a39a91842cf745e5fc27dbd6485aad44d839a4 (patch)
treed4536e303954fc52c189fc3140c46810e9832766 /builtin-init-db.c
parentccc852c37751c7bc8f81bfb71e6722291270bca5 (diff)
parent1b89eaa4bef44ef84f2af611d5db8727e3be266c (diff)
downloadgit-03a39a91842cf745e5fc27dbd6485aad44d839a4.tar.gz
Merge branch 'jc/shared-literally'
* jc/shared-literally: t1301: loosen test for forced modes set_shared_perm(): sometimes we know what the final mode bits should look like move_temp_to_file(): do not forget to chmod() in "Coda hack" codepath Move chmod(foo, 0444) into move_temp_to_file() "core.sharedrepository = 0mode" should set, not loosen
Diffstat (limited to 'builtin-init-db.c')
-rw-r--r--builtin-init-db.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/builtin-init-db.c b/builtin-init-db.c
index fc63d0fce5..4e02b33bb7 100644
--- a/builtin-init-db.c
+++ b/builtin-init-db.c
@@ -194,6 +194,8 @@ static int create_default_files(const char *template_path)
git_config(git_default_config, NULL);
is_bare_repository_cfg = init_is_bare_repository;
+
+ /* reading existing config may have overwrote it */
if (init_shared_repository != -1)
shared_repository = init_shared_repository;
@@ -312,12 +314,15 @@ int init_db(const char *template_dir, unsigned int flags)
* and compatibility values for PERM_GROUP and
* PERM_EVERYBODY.
*/
- if (shared_repository == PERM_GROUP)
+ if (shared_repository < 0)
+ /* force to the mode value */
+ sprintf(buf, "0%o", -shared_repository);
+ else if (shared_repository == PERM_GROUP)
sprintf(buf, "%d", OLD_PERM_GROUP);
else if (shared_repository == PERM_EVERYBODY)
sprintf(buf, "%d", OLD_PERM_EVERYBODY);
else
- sprintf(buf, "0%o", shared_repository);
+ die("oops");
git_config_set("core.sharedrepository", buf);
git_config_set("receive.denyNonFastforwards", "true");
}
@@ -397,6 +402,9 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
usage(init_db_usage);
}
+ if (init_shared_repository != -1)
+ shared_repository = init_shared_repository;
+
/*
* GIT_WORK_TREE makes sense only in conjunction with GIT_DIR
* without --bare. Catch the error early.