threads / patch / 6489

patchAllow default core.logallrefupdates to be overridden with template's config

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

## tl;dr

8 messages between Jan 23, 2007 and Jan 24, 2007. Diffs are folded; open one to read it.

replies: 7people: 5as markdown or json

Alex Riesen· Jan 23, 2007, 15:54 UTC · lore
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---

Never found a use for the reflogs and tried to switch them off. Didn't work - init-db rewrote it.

 builtin-init-db.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
From 713c4890ce795c840f5b4468db8689de44572ef8 Mon Sep 17 00:00:00 2001
From: Alex Riesen <raa.lkml@gmail.com>
Date: Tue, 23 Jan 2007 16:51:18 +0100
Subject: [PATCH] Allow default core.logallrefupdates to be overridden with template's config
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---
 builtin-init-db.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
Show changes to builtin-init-db.c +3 −1
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;
 }
-- 
1.5.0.rc2.g83d3
Linus Torvalds· Jan 23, 2007, 16:32 UTC · re: Alex Riesen · lore

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

Alex,
 just out of curiosity, what _is_ your curious text-attachment thing:
   1 Shown      8 lines  Text (charset: UTF-8)
   2   OK    ~928 bytes  Text (charset: ANSI_X3.4-1968)

where your normal text is UTF-8, but then attachments are in some really strange encoding name (why not just call it iso-8859-15? Don't ask me..)

Anyway. Strange. 
		Linus
Uwe Kleine-König· Jan 23, 2007, 17:58 UTC · re: Linus Torvalds · lore

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

Hi Linus,
Linus Torvalds wrote:
>  just out of curiosity, what _is_ your curious text-attachment thing:
> 
>    1 Shown      8 lines  Text (charset: UTF-8)
>    2   OK    ~928 bytes  Text (charset: ANSI_X3.4-1968)
ANSI_X3.4-1968 is just the offical name for us-ascii.
	zeisberg@cepheus:~$ LANG=C locale charmap
	ANSI_X3.4-1968
I'm not sure that this was making you curious.

Another strange thing is, that Alex' MUA choosed "Content-Transfer-Encoding: 7bit" for the first part although UTF-8 is an 8bit charset.

Best regards Uwe

-- 
Uwe Kleine-König

http://www.google.com/search?q=the+speed+of+light+in+m%2Fs
Alex Riesen· Jan 23, 2007, 22:06 UTC · re: Linus Torvalds · lore

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

On 1/23/07, Linus Torvalds <torvalds@linux-foundation.org> wrote:
Show 9 quoted lines
>  just out of curiosity, what _is_ your curious text-attachment thing:
>
>    1 Shown      8 lines  Text (charset: UTF-8)
>    2   OK    ~928 bytes  Text (charset: ANSI_X3.4-1968)
>
> where your normal text is UTF-8, but then attachments are in some really
> strange encoding name (why not just call it iso-8859-15? Don't ask me..)
>
> Anyway. Strange.

That's Google Mail. The Webmailer. Have no other means to send mail at that time of day.

Junio C Hamano· Jan 24, 2007, 01:34 UTC · re: Alex Riesen · lore

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

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.

Johannes Schindelin· Jan 24, 2007, 01:49 UTC · re: Junio C Hamano · lore

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

Hi,
On Tue, 23 Jan 2007, Junio C Hamano wrote:
> While on the topic of config files, we should fix the config
> reader not to allow per-repository variables in ~/.gitconfig

So we finally get this central place where all possible config variables are listed, with options (a la struct cmd_struct) which tell more about where they may be used?

While I think this might make sense, I feel quite uneasy about such a drastic change between -rc2 and -final.

Ciao, Dscho

Junio C Hamano· Jan 24, 2007, 01:51 UTC · re: Johannes Schindelin · lore

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

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 9 quoted lines
>> While on the topic of config files, we should fix the config
>> reader not to allow per-repository variables in ~/.gitconfig
>
> So we finally get this central place where all possible config variables 
> are listed, with options (a la struct cmd_struct) which tell more about 
> where they may be used?
>
> While I think this might make sense, I feel quite uneasy about such a 
> drastic change between -rc2 and -final.

I do not like the "config registry" in 1.5.0 but a simple blacklisting should work, shouldn't it?

Junio C Hamano· Jan 24, 2007, 01:53 UTC · re: Junio C Hamano · lore

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

Junio C Hamano <junkio@cox.net> writes:
> 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".

This part is not true -- as we copy the templated config which has explicit "no steenking reflog" to the new repository.

So I am Ok with your patch.

← back to recent threads