git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: bug: 'core.logallrefupdates' is not set by default in non-bare repository

From
Dennis Kaarsemaker <dennis@kaarsemaker.net>
Date
Aug 31, 2016, 09:12 UTC
Message-ID
<1472634746.4265.47.camel@kaarsemaker.net>
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
> 
> 
Previous: doakNext: Jeff King
Message 2 of 8 in “bug: 'core.logallrefupdates' is not set by default in non-bare repository”
  1. doakAug 31, 2016
  2. Dennis KaarsemakerAug 31, 2016
  3. Jeff KingAug 31, 2016
  4. Dennis KaarsemakerAug 31, 2016
  5. Jeff KingSep 2, 2016
  6. Jeff KingSep 2, 2016
  7. Dennis KaarsemakerSep 2, 2016
  8. Jeff KingSep 2, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.