git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dennis Kaarsemaker <dennis@kaarsemaker.net>
To: doak <doak@gmx.de>, "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: bug: 'core.logallrefupdates' is not set by default in non-bare repository
Date: Wed, 31 Aug 2016 11:12:26 +0200	[thread overview]
Message-ID: <1472634746.4265.47.camel@kaarsemaker.net> (raw)
In-Reply-To: <c46d36ef-3c2e-374f-0f2e-ffe31104e023@gmx.de>

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
> 
> 

  reply	other threads:[~2016-08-31  9:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-31  8:09 bug: 'core.logallrefupdates' is not set by default in non-bare repository doak
2016-08-31  9:12 ` Dennis Kaarsemaker [this message]
2016-08-31 10:48   ` Jeff King
2016-08-31 15:32     ` Dennis Kaarsemaker
2016-09-02  8:04       ` Jeff King
2016-09-02  8:47         ` Jeff King
2016-09-02  9:01         ` Dennis Kaarsemaker
2016-09-02  9:11           ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1472634746.4265.47.camel@kaarsemaker.net \
    --to=dennis@kaarsemaker.net \
    --cc=doak@gmx.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).