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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]