Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2023-05-16 09:33:43 +0300
committerJunio C Hamano <gitster@pobox.com>2023-06-21 21:14:34 +0300
commitfc8173505703a08bea5c648f1ab286013c3fd730 (patch)
treed68497413bfe6aae4b8922715d041abbd573eb35 /builtin/init-db.c
parentc2f76965d0202a894c9491e0647b7834b58cd168 (diff)
init-db, clone: change unnecessary global into passed parameter
Much like the parent commit, this commit was prompted by a desire to move the functions which builtin/init-db.c and builtin/clone.c share out of the former file and into setup.c. A secondary issue that made it difficult was the init_shared_repository global variable; replace it with a simple parameter that is passed to the relevant functions. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/init-db.c')
-rw-r--r--builtin/init-db.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/builtin/init-db.c b/builtin/init-db.c
index 32ab0a13e0..ae0122534a 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -31,8 +31,6 @@
#define GIT_DEFAULT_HASH_ENVIRONMENT "GIT_DEFAULT_HASH"
-static int init_shared_repository = -1;
-
static void copy_templates_1(struct strbuf *path, struct strbuf *template_path,
DIR *dir)
{
@@ -199,6 +197,7 @@ static int create_default_files(const char *template_path,
const char *initial_branch,
const struct repository_format *fmt,
int prev_bare_repository,
+ int init_shared_repository,
int quiet)
{
struct stat st1;
@@ -418,7 +417,7 @@ static void validate_hash_algorithm(struct repository_format *repo_fmt, int hash
int init_db(const char *git_dir, const char *real_git_dir,
const char *template_dir, int hash, const char *initial_branch,
- unsigned int flags)
+ int init_shared_repository, unsigned int flags)
{
int reinit;
int exist_ok = flags & INIT_DB_EXIST_OK;
@@ -464,6 +463,7 @@ int init_db(const char *git_dir, const char *real_git_dir,
reinit = create_default_files(template_dir, original_git_dir,
initial_branch, &repo_fmt,
prev_bare_repository,
+ init_shared_repository,
flags & INIT_DB_QUIET);
if (reinit && initial_branch)
warning(_("re-init: ignored --initial-branch=%s"),
@@ -575,6 +575,7 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
const char *object_format = NULL;
const char *initial_branch = NULL;
int hash_algo = GIT_HASH_UNKNOWN;
+ int init_shared_repository = -1;
const struct option init_db_options[] = {
OPT_STRING(0, "template", &template_dir, N_("template-directory"),
N_("directory from which templates will be used")),
@@ -732,5 +733,5 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
flags |= INIT_DB_EXIST_OK;
return init_db(git_dir, real_git_dir, template_dir, hash_algo,
- initial_branch, flags);
+ initial_branch, init_shared_repository, flags);
}