summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 457f06d)
raw | patch | inline | side by side (parent: 457f06d)
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Thu, 22 Dec 2005 22:19:37 +0000 (23:19 +0100) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sat, 24 Dec 2005 08:21:10 +0000 (00:21 -0800) |
Now you can say
git-init-db --shared
if you want other users to be able to push into that repository.
[jc: info/ and objects/info/ need to be group writable if the
repository is shared --- otherwise packs and refs files cannot
be updated.]
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-init-db --shared
if you want other users to be able to push into that repository.
[jc: info/ and objects/info/ need to be group writable if the
repository is shared --- otherwise packs and refs files cannot
be updated.]
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
init-db.c | patch | blob | history |
diff --git a/init-db.c b/init-db.c
index ead37b5ed86e5ae96c18d081fbfffd65ed74dce8..ff294960f29c8763e34e28060dee04b799bd55fd 100644 (file)
--- a/init-db.c
+++ b/init-db.c
#define DEFAULT_GIT_TEMPLATE_DIR "/usr/share/git-core/templates/"
#endif
-static void safe_create_dir(const char *dir)
+static void safe_create_dir(const char *dir, int share)
{
if (mkdir(dir, 0777) < 0) {
if (errno != EEXIST) {
exit(1);
}
}
+ else if (share && adjust_shared_perm(dir))
+ die("Could not make %s writable by group\n", dir);
}
static int copy_file(const char *dst, const char *src, int mode)
}
status = copy_fd(fdi, fdo);
close(fdo);
+
+ if (!status && adjust_shared_perm(dst))
+ return -1;
+
return status;
}
* with the way the namespace under .git/ is organized, should
* be really carefully chosen.
*/
- safe_create_dir(path);
+ safe_create_dir(path, 1);
while ((de = readdir(dir)) != NULL) {
struct stat st_git, st_template;
int namelen;
* Create .git/refs/{heads,tags}
*/
strcpy(path + len, "refs");
- safe_create_dir(path);
+ safe_create_dir(path, 1);
strcpy(path + len, "refs/heads");
- safe_create_dir(path);
+ safe_create_dir(path, 1);
strcpy(path + len, "refs/tags");
- safe_create_dir(path);
+ safe_create_dir(path, 1);
/* First copy the templates -- we might have the default
* config file there, in which case we would want to read
}
static const char init_db_usage[] =
-"git-init-db [--template=<template-directory>]";
+"git-init-db [--template=<template-directory>] [--shared]";
/*
* If you want to, you can share the DB area with any number of branches.
char *arg = argv[1];
if (!strncmp(arg, "--template=", 11))
template_dir = arg+11;
+ else if (!strcmp(arg, "--shared"))
+ shared_repository = 1;
else
die(init_db_usage);
}
git_dir = DEFAULT_GIT_DIR_ENVIRONMENT;
fprintf(stderr, "defaulting to local storage area\n");
}
- safe_create_dir(git_dir);
+ safe_create_dir(git_dir, 0);
/* Check to see if the repository version is right.
* Note that a newly created repository does not have
path = xmalloc(len + 40);
memcpy(path, sha1_dir, len);
- safe_create_dir(sha1_dir);
+ safe_create_dir(sha1_dir, 1);
strcpy(path+len, "/pack");
- safe_create_dir(path);
+ safe_create_dir(path, 1);
strcpy(path+len, "/info");
- safe_create_dir(path);
+ safe_create_dir(path, 1);
+
+ if (shared_repository)
+ git_config_set("core.sharedRepository", "true");
+
return 0;
}