aboutsummaryrefslogtreecommitdiff
path: root/builtin-init-db.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-06-09 22:07:23 -0700
committerJunio C Hamano <junkio@cox.net>2006-06-09 22:15:50 -0700
commit138086a72582620e0b3ec0aa60a78da208e89a2a (patch)
treeba4cb91659773ed349464247e93a765a10999ac6 /builtin-init-db.c
parentf6407823d1467a6b6d2002878a64dec42df0a361 (diff)
downloadgit-138086a72582620e0b3ec0aa60a78da208e89a2a.tar.gz
git-138086a72582620e0b3ec0aa60a78da208e89a2a.tar.xz
shared repository - add a few missing calls to adjust_shared_perm().
There were a few calls to adjust_shared_perm() that were missing: - init-db creates refs, refs/heads, and refs/tags before reading from templates that could specify sharedrepository in the config file; - updating config file created it under user's umask without adjusting; - updating refs created it under user's umask without adjusting; - switching branches created .git/HEAD under user's umask without adjusting. This moves adjust_shared_perm() from sha1_file.c to path.c, since a few SIMPLE_PROGRAM need to call repository configuration functions which in turn need to call adjust_shared_perm(). sha1_file.c needs to link with SHA1 computation library which is usually not linked to SIMPLE_PROGRAM. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-init-db.c')
-rw-r--r--builtin-init-db.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/builtin-init-db.c b/builtin-init-db.c
index 88b39a47e..6a24e9bca 100644
--- a/builtin-init-db.c
+++ b/builtin-init-db.c
@@ -199,6 +199,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.
*/