git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / Atom feed
From: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH v2 0/1] Fix git init with core.hidedotfiles
Date: Mon, 11 Mar 2019 13:10:57 -0700 (PDT)
Message-ID: <pull.131.v2.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.131.git.gitgitgadget@gmail.com>

This fixes an regression that was not present in Git for Windows's original 
core.hideDotFiles patch, but in the shape of the core.hideDotFiles patch
that made it into git.git.

We fixed it in one big hurry in Git for Windows, and I simply forgot to
upstream this right away.

Changes since v1:

 * Clarified in the code comment that our intention is to pick up 
   core.hidedotfiles in the first git_config() call.
 * Explained in the commit message why we cannot remove the 
   git_config(git_init_db_config, NULL) call from create_default_files(): it
   would cause a change of behavior with regard to the init.templatedir 
   setting.
 * Simplified the test case.

Johannes Schindelin (1):
  mingw: respect core.hidedotfiles = false in git-init again

 builtin/init-db.c |  7 +++++++
 t/t0001-init.sh   | 11 +++++++++++
 2 files changed, 18 insertions(+)


base-commit: e902e9bcae2010bc42648c80ab6adc6c5a16a4a5
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-131%2Fdscho%2Funhidden-git-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-131/dscho/unhidden-git-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/131

Range-diff vs v1:

 1:  008e367d26 ! 1:  f187d0d247 mingw: respect core.hidedotfiles = false in git-init again
     @@ -12,6 +12,12 @@
          The fix is obvious: read the (limited, pre-init) config *before*
          creating the .git/ directory.
      
     +    Please note that we cannot remove the identical-looking `git_config()`
     +    call from `create_default_files()`: we create the `.git/` directory
     +    between those calls. If we removed it, and if the parent directory is
     +    in a Git worktree, and if that worktree's `.git/config` contained any
     +    `init.templatedir` setting, we would all of a sudden pick that up.
     +
          This fixes https://github.com/git-for-windows/git/issues/789
      
          Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
     @@ -29,11 +35,19 @@
       	return 0;
       }
       
     +@@
     + 	struct strbuf err = STRBUF_INIT;
     + 
     + 	/* Just look for `init.templatedir` */
     ++	init_db_template_dir = NULL; /* re-set in case it was set before */
     + 	git_config(git_init_db_config, NULL);
     + 
     + 	/*
      @@
       	}
       	startup_info->have_repository = 1;
       
     -+	/* Just look for `init.templatedir` and `core.hidedotfiles` */
     ++	/* Just look for `core.hidedotfiles` */
      +	git_config(git_init_db_config, NULL);
      +
       	safe_create_dir(git_dir, 0);
     @@ -50,11 +64,10 @@
      +test_expect_success MINGW 'core.hidedotfiles = false' '
      +	git config --global core.hidedotfiles false &&
      +	rm -rf newdir &&
     ++	mkdir newdir &&
      +	(
      +		sane_unset GIT_DIR GIT_WORK_TREE GIT_CONFIG &&
     -+		mkdir newdir &&
     -+		cd newdir &&
     -+		git init
     ++		git -C newdir init
      +	) &&
      +	! is_hidden newdir/.git
      +'

-- 
gitgitgadget

  parent reply	other threads:[~2019-03-11 20:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-07  9:35 [PATCH " 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
2019-03-11 19:56     ` Johannes Schindelin
2019-03-11 20:10 ` Johannes Schindelin via GitGitGadget [this message]
2019-03-11 20:10   ` [PATCH v2 " 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=pull.131.v2.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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

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