git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: Re: [PATCH 1/1] mingw: respect core.hidedotfiles = false in git-init again
Date: Fri, 08 Mar 2019 12:18:53 +0900
Message-ID: <xmqqva0ujboi.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <008e367d26de12debd596e8f16356f70c74d3d7e.1551951339.git.gitgitgadget@gmail.com> (Johannes Schindelin via GitGitGadget's message of "Thu, 07 Mar 2019 01:35:40 -0800 (PST)")

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

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

> +	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()?

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

Other than these, I find nothing questionable in the patch.  Nicely
done.



  reply	other threads:[~2019-03-08  3:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-07  9:35 [PATCH 0/1] Fix git init with core.hidedotfiles Johannes Schindelin via GitGitGadget
2019-03-07  9:35 ` [PATCH 1/1] mingw: respect core.hidedotfiles = false in git-init again Johannes Schindelin via GitGitGadget
2019-03-08  3:18   ` Junio C Hamano [this message]
2019-03-11 19:56     ` Johannes Schindelin
2019-03-11 20:10 ` [PATCH v2 0/1] Fix git init with core.hidedotfiles Johannes Schindelin via GitGitGadget
2019-03-11 20:10   ` [PATCH v2 1/1] mingw: respect core.hidedotfiles = false in git-init again Johannes Schindelin via GitGitGadget

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=xmqqva0ujboi.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=johannes.schindelin@gmx.de \
    /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

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for the project(s) associated with this inbox:

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

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git