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

Re: [PATCH] Allow default core.logallrefupdates to be overridden with template's config

From
Junio C Hamano <junkio@cox.net>
Date
Jan 24, 2007, 01:34 UTC
Message-ID
<7v64axmcmr.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<81b0412b0701230754p3425ded4k1f37dd26500c1744@mail.gmail.com>
Show 19 quoted lines
> ---
>  builtin-init-db.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/builtin-init-db.c b/builtin-init-db.c
> index 8e7540b..1865489 100644
> --- a/builtin-init-db.c
> +++ b/builtin-init-db.c
> @@ -257,7 +257,9 @@ static int create_default_files(const char *git_dir, const char *template_path)
>  	}
>  	else {
>  		git_config_set("core.bare", "false");
> -		git_config_set("core.logallrefupdates", "true");
> +		/* allow template config file to override the default */
> +		if (log_all_ref_updates == -1)
> +		    git_config_set("core.logallrefupdates", "true");
>  	}
>  	return reinit;
>  }

It is sensible to let the user say "I do not want steenking reflogs" (or "I love reflogs and want one everywhere"). But I think the above is not really doing that.

We seem to read ~/.gitconfig while running git-init-db, and I do not think doing so necessarily is a bug. After all, there may be some configurations you would want to have in ~/.gitconfig to control the way git-init-db operates (right now I do not think there is any).

That makes your new check depend on what is in ~/.gitconfig when core.logallrefupdates is not set (either true or false) in the template config.

Forgetting the case of having the variable in ~/.gitconfig, what does it mean to have core.logallrefupdates set in a template config? Setting it to true is obvious -- "I want reflogs everywhere", and I think it happens with or without your patch, because create_default_files() copies the template.

However, when set to false, your check says "Do not set it per-repo". This tells git to follow the default "use reflog in non-bare repositories" and it does not mean "I do not want steenking reflogs anywhere". So I think at least you would need to check for (log_all_ref_updates == 0) and set it explicitly to "false".

While on the topic of config files, we should fix the config reader not to allow per-repository variables in ~/.gitconfig (issuing warning and ignoring, or erroring out), as some variables such as core.sharedrepository are inherently per repository. core.repositoryformatversion has the same issue, but we do set it per repository explicitly with init-db, which makes sure that whatever value in ~/.gitconfig is ignored.

Previous: Alex RiesenNext: Johannes Schindelin
Message 5 of 8 in “Allow default core.logallrefupdates to be overridden with template's config”
  1. Allow default core.logallrefupdates to be overridden with template's configAlex Riesen, Jan 23, 2007
  2. Linus TorvaldsJan 23, 2007
  3. Uwe Kleine-KönigJan 23, 2007
  4. Alex RiesenJan 23, 2007
  5. Junio C HamanoJan 24, 2007
  6. Johannes SchindelinJan 24, 2007
  7. Junio C HamanoJan 24, 2007
  8. Junio C HamanoJan 24, 2007

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.