environment: move access to "core.sharedRepository" into repo settings
Similar as with the preceding commit, we track "core.sharedRepository" via a pair of global variables. Move them into `struct repo_settings` so that we can instead track them per-repository. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
6f3fbed8ed
commit
f1ce861c34
21
setup.c
21
setup.c
@ -2332,7 +2332,7 @@ static int create_default_files(const char *template_path,
|
||||
*/
|
||||
copy_templates(template_path);
|
||||
git_config_clear();
|
||||
reset_shared_repository();
|
||||
repo_settings_reset_shared_repository(the_repository);
|
||||
git_config(git_default_config, NULL);
|
||||
|
||||
reinit = is_reinit();
|
||||
@ -2342,7 +2342,8 @@ static int create_default_files(const char *template_path,
|
||||
* values we might have just re-read from the config.
|
||||
*/
|
||||
if (init_shared_repository != -1)
|
||||
set_shared_repository(init_shared_repository);
|
||||
repo_settings_set_shared_repository(the_repository,
|
||||
init_shared_repository);
|
||||
|
||||
is_bare_repository_cfg = !work_tree;
|
||||
|
||||
@ -2350,7 +2351,7 @@ static int create_default_files(const char *template_path,
|
||||
* We would have created the above under user's umask -- under
|
||||
* shared-repository settings, we would need to fix them up.
|
||||
*/
|
||||
if (get_shared_repository()) {
|
||||
if (repo_settings_get_shared_repository(the_repository)) {
|
||||
adjust_shared_perm(repo_get_git_dir(the_repository));
|
||||
}
|
||||
|
||||
@ -2597,7 +2598,7 @@ int init_db(const char *git_dir, const char *real_git_dir,
|
||||
initial_branch, flags & INIT_DB_QUIET);
|
||||
create_object_directory();
|
||||
|
||||
if (get_shared_repository()) {
|
||||
if (repo_settings_get_shared_repository(the_repository)) {
|
||||
char buf[10];
|
||||
/* We do not spell "group" and such, so that
|
||||
* the configuration can be read by older version
|
||||
@ -2605,12 +2606,12 @@ int init_db(const char *git_dir, const char *real_git_dir,
|
||||
* and compatibility values for PERM_GROUP and
|
||||
* PERM_EVERYBODY.
|
||||
*/
|
||||
if (get_shared_repository() < 0)
|
||||
if (repo_settings_get_shared_repository(the_repository) < 0)
|
||||
/* force to the mode value */
|
||||
xsnprintf(buf, sizeof(buf), "0%o", -get_shared_repository());
|
||||
else if (get_shared_repository() == PERM_GROUP)
|
||||
xsnprintf(buf, sizeof(buf), "0%o", -repo_settings_get_shared_repository(the_repository));
|
||||
else if (repo_settings_get_shared_repository(the_repository) == PERM_GROUP)
|
||||
xsnprintf(buf, sizeof(buf), "%d", OLD_PERM_GROUP);
|
||||
else if (get_shared_repository() == PERM_EVERYBODY)
|
||||
else if (repo_settings_get_shared_repository(the_repository) == PERM_EVERYBODY)
|
||||
xsnprintf(buf, sizeof(buf), "%d", OLD_PERM_EVERYBODY);
|
||||
else
|
||||
BUG("invalid value for shared_repository");
|
||||
@ -2622,12 +2623,12 @@ int init_db(const char *git_dir, const char *real_git_dir,
|
||||
int len = strlen(git_dir);
|
||||
|
||||
if (reinit)
|
||||
printf(get_shared_repository()
|
||||
printf(repo_settings_get_shared_repository(the_repository)
|
||||
? _("Reinitialized existing shared Git repository in %s%s\n")
|
||||
: _("Reinitialized existing Git repository in %s%s\n"),
|
||||
git_dir, len && git_dir[len-1] != '/' ? "/" : "");
|
||||
else
|
||||
printf(get_shared_repository()
|
||||
printf(repo_settings_get_shared_repository(the_repository)
|
||||
? _("Initialized empty shared Git repository in %s%s\n")
|
||||
: _("Initialized empty Git repository in %s%s\n"),
|
||||
git_dir, len && git_dir[len-1] != '/' ? "/" : "");
|
||||
|
Reference in New Issue
Block a user