threads / discuss / 58119

--git-dir= leads to "The empty string is not a valid path" only some times

Subject: --git-dir= leads to "The empty string is not a valid path" only some times

## tl;dr

One message between Jul 7, 2022 and Jul 7, 2022.

replies: 0people: 1as markdown or json

Yaroslav Halchenko· Jul 7, 2022, 15:56 UTC · lore
Dear Git Gurus,

The original reported issue possibly with more details: https://github.com/datalad/datalad/issues/6815

Background: in DataLad we specify empty value for --git-dir in
    git --git-dir= config -z -l --show-origin

call to ensure that we are not picking up any local repository configurations if called while being under some repo. It had been working just fine for years until today user reported that such call errors out with

	$> git --git-dir= config -z -l --show-origin > /dev/null
	fatal: The empty string is not a valid path
because of having 
	[includeIf "gitdir:**/devbgc/**"]
		path = ~/.gitconfig_bgc
in user's ~/.gitconfig (I have reproduced with git  2.35.1).
Note: specifying some non-empty path pointing to some non-existing path (e.g.
--git-dir=/non-existing) does not cause error.
- should not git behavior on --git-dir  be consistent regardless of the content
of ~/.gitconfig ?
- is use --git-dir= generally legit (seems not documented)?  If not -- why it
is not whenever pointing to non-existing directory is?
- what is a more "legit" way to achieve "do not load local repository
config if under a git repository path"?
Thank you in advance for the clarifications,
-- 
Yaroslav O. Halchenko
Center for Open Neuroscience     http://centerforopenneuroscience.org
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
WWW:   http://www.linkedin.com/in/yarik        

← back to recent threads