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

Re: [PATCH 1/1] mingw: respect core.hidedotfiles = false in git-init again

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Mar 11, 2019, 19:56 UTC
Message-ID
<nycvar.QRO.7.76.6.1903112037070.41@tvgsbejvaqbjf.bet>
In-Reply-To
<xmqqva0ujboi.fsf@gitster-ct.c.googlers.com>
Hi Junio,
On Fri, 8 Mar 2019, Junio C Hamano wrote:
Show 21 quoted lines
> "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
> writes:
> 
> > diff --git a/builtin/init-db.c b/builtin/init-db.c
> > index 93eff7618c..94df241ad5 100644
> > --- a/builtin/init-db.c
> > +++ b/builtin/init-db.c
> > @@ -155,6 +155,9 @@ static int git_init_db_config(const char *k, const char *v, void *cb)
> >  	if (!strcmp(k, "init.templatedir"))
> >  		return git_config_pathname(&init_db_template_dir, k, v);
> >  
> > +	if (starts_with(k, "core."))
> > +		return platform_core_config(k, v, cb);
> > +
> >  	return 0;
> >  }
> 
> OK.  I think this is very much futureproof and a sensible thing to
> have a "platform_core_config()" call here.  That way, we do not have
> to say the details of what platform specific thing each platform
> wants when init_db_config works.
I am glad you agree.
Show 9 quoted lines
> > @@ -361,6 +364,9 @@ int init_db(const char *git_dir, const char *real_git_dir,
> >  	}
> >  	startup_info->have_repository = 1;
> >  
> > +	/* Just look for `init.templatedir` and `core.hidedotfiles` */
> 
> And from that point of view, replacing `core.hidedotfiles` with
> something like "platform specific core config" would be more
> appropriate.

Probably. But it could potentially make some developer (such as myself, six months from now) wonder why we don't just remove this call because clearly nothing uses this on Linux.

So even if it is not quite future-proof from the point of view where we *technically* would have to extend this comment if we ever introduced another platform-specific config setting that is relevant to the early phase of `git init`, I would like to keep the comment in the current form.

Well, actually *almost* in the current form.

I did realize, based on your comment below, that the mention of `init.templatedir` here is bogus, wrong even: if `git init` is started in a Git worktree, we do not *want* to use the `init.templatedir` setting from said worktree.

And that is the reason why...
Show 6 quoted lines
> > +	git_config(git_init_db_config, NULL);
> > +
> 
> We use git_init_db_config from create_default_files(), which is a
> function called several lines after this point; shouldn't that now
> be removed from create_default_files()?
... we have to call `git_config()` *again* in `create_default_files()`.
Show 31 quoted lines
> >  	safe_create_dir(git_dir, 0);
> >  
> >  	init_is_bare_repository = is_bare_repository();
> > diff --git a/t/t0001-init.sh b/t/t0001-init.sh
> > index 42a263cada..35ede1b0b0 100755
> > --- a/t/t0001-init.sh
> > +++ b/t/t0001-init.sh
> > @@ -453,6 +453,18 @@ test_expect_success 're-init from a linked worktree' '
> >  	)
> >  '
> >  
> > +test_expect_success MINGW 'core.hidedotfiles = false' '
> > +	git config --global core.hidedotfiles false &&
> > +	rm -rf newdir &&
> > +	(
> > +		sane_unset GIT_DIR GIT_WORK_TREE GIT_CONFIG &&
> > +		mkdir newdir &&
> > +		cd newdir &&
> > +		git init
> > +	) &&
> 
> This is not incorrect per-se, but I think most tests do the mkdir
> outside subshell, i.e.
> 
> 	rm -rf newdir &&
> 	mkdir newdir &&
> 	(
> 		cd newdir &&
> 		sane_unset ... &&
> 		...
> 	) &&
Legit.

Thanks, Dscho

Show 6 quoted lines
> 
> Other than these, I find nothing questionable in the patch.  Nicely
> done.
> 
> 
> 
Previous: Junio C HamanoNext: Johannes Schindelin via GitGitGadget
Message 4 of 6 in “Fix git init with core.hidedotfiles”
  1. 0/1 Fix git init with core.hidedotfilesJohannes Schindelin via GitGitGadget, Mar 7, 2019
  2. 1/1 mingw: respect core.hidedotfiles = false in git-init againJohannes Schindelin via GitGitGadget, Mar 7, 2019
  3. Junio C HamanoMar 8, 2019
  4. Johannes SchindelinMar 11, 2019
  5. 0/1 Fix git init with core.hidedotfilesJohannes Schindelin via GitGitGadget, Mar 11, 2019
  6. 1/1 mingw: respect core.hidedotfiles = false in git-init againJohannes Schindelin via GitGitGadget, Mar 11, 2019

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.