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

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

From
Yaroslav Halchenko <yoh@onerussian.com>
Date
Jul 7, 2022, 15:56 UTC
Message-ID
<YscCKuoDPBbs4iPX@lena.dartmouth.edu>
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        
Message 1 of 1 in “--git-dir= leads to "The empty string is not a valid path" only some times”
  1. Yaroslav HalchenkoJul 7, 2022

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.