31
32
#define GIT_DEFAULT_HASH_ENVIRONMENT "GIT_DEFAULT_HASH"
33
34
-static int init_is_bare_repository = 0;
34
static int init_shared_repository = -1;
35
36
static void copy_templates_1(struct strbuf *path, struct strbuf *template_path,
198
const char *original_git_dir,
199
const char *initial_branch,
200
const struct repository_format *fmt,
201
+ int prev_bare_repository,
202
int quiet)
203
{
204
struct stat st1;
237
* TODO: heed core.bare from config file in templates if no
238
* command-line override given
239
*/
240
- is_bare_repository_cfg = init_is_bare_repository || !work_tree;
240
+ is_bare_repository_cfg = prev_bare_repository || !work_tree;
241
/* TODO (continued):
242
*
243
* Unfortunately, the line above is equivalent to
246
* command line option was present.
247
*
248
* To see why, note that before this function, there was this call:
249
- * init_is_bare_repository = is_bare_repository()
249
+ * prev_bare_repository = is_bare_repository()
250
* expanding the right hand side:
251
* = is_bare_repository_cfg && !get_git_work_tree()
252
* = is_bare_repository_cfg && !work_tree
256
* calls will return the same result each time. So, what we are
257
* interested in computing is the right hand side of the line of
258
* code just above this comment:
259
- * init_is_bare_repository || !work_tree
259
+ * prev_bare_repository || !work_tree
260
* = is_bare_repository_cfg && !work_tree || !work_tree
261
* = !work_tree
262
* because "A && !B || !B == !B" for all boolean values of A & B.
424
int exist_ok = flags & INIT_DB_EXIST_OK;
425
char *original_git_dir = real_pathdup(git_dir, 1);
426
struct repository_format repo_fmt = REPOSITORY_FORMAT_INIT;
427
+ int prev_bare_repository;
428
429
if (real_git_dir) {
430
struct stat st;
450
451
safe_create_dir(git_dir, 0);
452
452
- init_is_bare_repository = is_bare_repository();
453
+ prev_bare_repository = is_bare_repository();
454
455
/* Check to see if the repository version is right.
456
* Note that a newly created repository does not have
463
464
reinit = create_default_files(template_dir, original_git_dir,
465
initial_branch, &repo_fmt,
466
+ prev_bare_repository,
467
flags & INIT_DB_QUIET);
468
if (reinit && initial_branch)
469
warning(_("re-init: ignored --initial-branch=%s"),