git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Elijah Newren <newren@gmail.com>
Cc: Christian Couder <christian.couder@gmail.com>,
	 Ghanshyam Thakkar <shyamthakkar001@gmail.com>,
	 git@vger.kernel.org, johannes.schindelin@gmx.de
Subject: Re: [GSOC][RFC] Heed core.bare from template config file when no command line override given, as a microproject.
Date: Fri, 05 Jan 2024 07:59:02 -0800	[thread overview]
Message-ID: <xmqqjzonpy9l.fsf@gitster.g> (raw)
In-Reply-To: <CABPp-BH+cPdfsctquE60tw_nD6_LCaWf0JwGusuZ0tvQQuWy4w@mail.gmail.com> (Elijah Newren's message of "Thu, 4 Jan 2024 18:11:00 -0800")

Elijah Newren <newren@gmail.com> writes:

> If you look back at the mailing list discussion on the series that
> introduced this TODO comment you are trying to address, you'll note
> that both Glen and I dug into the code and attempted to explain it to
> each other, and we both got it wrong on our first try.

I think you meant 0f7443bd (init-db: document existing bug with
core.bare in template config, 2023-05-16), where it says:

    The comments in create_default_files() talks about reading config from
    the config file in the specified `--templates` directory, which leads to
    the question of whether core.bare could be set in such a config file and
    thus whether the code is doing the right thing.

But I suspect the all of the above comes from a misunderstanding.
The comment the above commit log message talks about is:

 /*
  * First copy the templates -- we might have the default
  * config file there, in which case we would want to read
  * from it after installing.
  *
  * Before reading that config, we also need to clear out any cached
  * values (since we've just potentially changed what's available on
  * disk).
  */

This primarily comes from my 4f629539 (init-db: check template and
repository format., 2005-11-25), whose focus was to control the way
HEAD symref is created, but care was taken to avoid propagating
values from the configuration variables in the template that do not
make sense for the repository being initialized.  The most important
thing being the repository format version, but the intent to avoid
nonsense combination between the characteristic the new repository
has and the configuration values copied from the template was not
limited to the format version.

Specifically, the commit that introduced the comment never wanted to
honor core.bare in the template.  I do not think I has core.bare in
mind when I wrote the comment, but I would have described it as the
same category as the repository format version, i.e. something you
would not want to copy, if I were pressed to clarify back then.

Besides, create_default_files() is way too late, even if we wanted
to create a bare repository when the template config file says
core.bare = true, as the caller would already have created before
passing $DIR (when "git --bare init $DIR" was run) or $DIR/.git
(when "git init $DIR" was run) to the function.

If somebody wants to always create a bare repository by having
core.bare=true in their template and if we wanted to honor it (which
I am dubious of the value of, by the way), I would think the right
place to do so would be way before create_default_files() is called.
When running "git init [$DIR]", long before calling init_db(), we
decide if we are about to create a bare repository and either create
$DIR or $DIR/.git.  What is in the template, if we really wanted to
do so, should be read before that happens, no?


  reply	other threads:[~2024-01-05 15:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-02 22:07 [GSOC][RFC] Heed core.bare from template config file when no command line override given, as a microproject Ghanshyam Thakkar
2024-01-04 10:24 ` Christian Couder
2024-01-04 10:39   ` Ghanshyam Thakkar
2024-01-05  2:11   ` Elijah Newren
2024-01-05 15:59     ` Junio C Hamano [this message]
2024-01-06 12:07       ` Ghanshyam Thakkar
2024-01-08 17:32         ` Junio C Hamano
2024-01-19  1:43           ` Elijah Newren
2024-02-29 13:41 ` [PATCH] setup: clarify TODO comment about ignoring core.bare Ghanshyam Thakkar
2024-02-29 19:15   ` Junio C Hamano
2024-02-29 20:58     ` Ghanshyam Thakkar
2024-03-04 15:18   ` [PATCH v2] setup: remove unnecessary variable Ghanshyam Thakkar
2024-03-04 18:16     ` Junio C Hamano
2024-03-04 21:27       ` Ghanshyam Thakkar
2024-03-04 21:53         ` Junio C Hamano

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=xmqqjzonpy9l.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=johannes.schindelin@gmx.de \
    --cc=newren@gmail.com \
    --cc=shyamthakkar001@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).