That is indeed a bug. git reads the config of t1 and then thinks a
template config has set that value, so it won't override it.
This is caused by git init reading the config via
get_shared_repository. The comment above it indicates that this may not
be needed, and indeed not doing it makes this bug go away.
diff --git a/builtin/init-db.c b/builtin/init-db.c
index 3a45f0b..b2883a6 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -494,14 +494,6 @@ int cmd_init_db(int argc, const char **argv, const char
*prefix)
retry:
if (chdir(argv[0]) < 0) {
if (!mkdir_tried) {
- int saved;
- /*
- * At this point we haven't read any
configuration,
- * and we know shared_repository should always
be 0;
- * but just in case we play safe.
- */
- saved = get_shared_repository();
- set_shared_repository(0);
switch
(safe_create_leading_directories_const(argv[0])) {
case SCLD_OK:
case SCLD_PERMS:
@@ -513,7 +505,6 @@ int cmd_init_db(int argc, const char **argv, const char
*prefix)
die_errno(_("cannot mkdir %s"),
argv[0]);
break;
}
- set_shared_repository(saved);
if (mkdir(argv[0], 0777) < 0)
die_errno(_("cannot mkdir %s"),
argv[0]);
mkdir_tried = 1;
On wo, 2016-08-31 at 10:09 +0200, doak wrote:
> Hi there,
>
> If 'git init /path/to/repo' is called inside another repository with
> 'core.logallrefupdates' set to true, it will be not set by default in
> the created repository.
> This seems to be a bug.
> I am using Git v2.9.3 (Arch).
>
> Steps to reproduce:
> ---------------------
> git init t1
> cd t1
> # 'core.logallrefupdates' will not be set for 't2'.
> git init ../t2
> ---------------------
>
> Stated from 'git-config(1)':
> ---------------------
> core.logAllRefUpdates
> [...]
> This value is true by default in a repository that has a
> working directory associated with it, and false by default in a bare
> repository.
> ---------------------
>
>
> With best regards,
> doak
>
>