|
17 | 17 | #define TEST_FILEMODE 1
|
18 | 18 | #endif
|
19 | 19 |
|
| 20 | +static int init_is_bare_repository = 0; |
| 21 | +static int init_shared_repository = -1; |
| 22 | + |
20 | 23 | static void safe_create_dir(const char *dir, int share)
|
21 | 24 | {
|
22 | 25 | if (mkdir(dir, 0777) < 0) {
|
@@ -191,6 +194,9 @@ static int create_default_files(const char *template_path)
|
191 | 194 | copy_templates(template_path);
|
192 | 195 |
|
193 | 196 | git_config(git_default_config, NULL);
|
| 197 | + is_bare_repository_cfg = init_is_bare_repository; |
| 198 | + if (init_shared_repository != -1) |
| 199 | + shared_repository = init_shared_repository; |
194 | 200 |
|
195 | 201 | /*
|
196 | 202 | * We would have created the above under user's umask -- under
|
@@ -277,6 +283,8 @@ int init_db(const char *template_dir, unsigned int flags)
|
277 | 283 |
|
278 | 284 | safe_create_dir(get_git_dir(), 0);
|
279 | 285 |
|
| 286 | + init_is_bare_repository = is_bare_repository(); |
| 287 | + |
280 | 288 | /* Check to see if the repository version is right.
|
281 | 289 | * Note that a newly created repository does not have
|
282 | 290 | * config file, so this will not fail. What we are catching
|
@@ -381,9 +389,9 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
|
381 | 389 | setenv(GIT_DIR_ENVIRONMENT, getcwd(git_dir,
|
382 | 390 | sizeof(git_dir)), 0);
|
383 | 391 | } else if (!strcmp(arg, "--shared"))
|
384 |
| - shared_repository = PERM_GROUP; |
| 392 | + init_shared_repository = PERM_GROUP; |
385 | 393 | else if (!prefixcmp(arg, "--shared="))
|
386 |
| - shared_repository = git_config_perm("arg", arg+9); |
| 394 | + init_shared_repository = git_config_perm("arg", arg+9); |
387 | 395 | else if (!strcmp(arg, "-q") || !strcmp(arg, "--quiet"))
|
388 | 396 | flags |= INIT_DB_QUIET;
|
389 | 397 | else
|
|
0 commit comments