@@ -31,7 +31,6 @@
#define GIT_DEFAULT_HASH_ENVIRONMENT "GIT_DEFAULT_HASH"
-static int init_is_bare_repository = 0;
static int init_shared_repository = -1;
static void copy_templates_1(struct strbuf *path, struct strbuf *template_path,
@@ -199,6 +198,7 @@ static int create_default_files(const char *template_path,
const char *original_git_dir,
const char *initial_branch,
const struct repository_format *fmt,
+ int prev_bare_repository,
int quiet)
{
struct stat st1;
@@ -237,7 +237,7 @@ static int create_default_files(const char *template_path,
* TODO: heed core.bare from config file in templates if no
* command-line override given
*/
- is_bare_repository_cfg = init_is_bare_repository || !work_tree;
+ is_bare_repository_cfg = prev_bare_repository || !work_tree;
/* TODO (continued):
*
* Unfortunately, the line above is equivalent to
@@ -246,7 +246,7 @@ static int create_default_files(const char *template_path,
* command line option was present.
*
* To see why, note that before this function, there was this call:
- * init_is_bare_repository = is_bare_repository()
+ * prev_bare_repository = is_bare_repository()
* expanding the right hand side:
* = is_bare_repository_cfg && !get_git_work_tree()
* = is_bare_repository_cfg && !work_tree
@@ -256,7 +256,7 @@ static int create_default_files(const char *template_path,
* calls will return the same result each time. So, what we are
* interested in computing is the right hand side of the line of
* code just above this comment:
- * init_is_bare_repository || !work_tree
+ * prev_bare_repository || !work_tree
* = is_bare_repository_cfg && !work_tree || !work_tree
* = !work_tree
* because "A && !B || !B == !B" for all boolean values of A & B.
@@ -424,6 +424,7 @@ int init_db(const char *git_dir, const char *real_git_dir,
int exist_ok = flags & INIT_DB_EXIST_OK;
char *original_git_dir = real_pathdup(git_dir, 1);
struct repository_format repo_fmt = REPOSITORY_FORMAT_INIT;
+ int prev_bare_repository;
if (real_git_dir) {
struct stat st;
@@ -449,7 +450,7 @@ int init_db(const char *git_dir, const char *real_git_dir,
safe_create_dir(git_dir, 0);
- init_is_bare_repository = is_bare_repository();
+ prev_bare_repository = is_bare_repository();
/* Check to see if the repository version is right.
* Note that a newly created repository does not have
@@ -462,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,
flags & INIT_DB_QUIET);
if (reinit && initial_branch)
warning(_("re-init: ignored --initial-branch=%s"),