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

Re: [PATCH] config: treat non-existent config files as empty

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Oct 21, 2010, 16:47 UTC
Message-ID
<20101021164708.GD3732@burratino>
In-Reply-To
<20101021144544.GA18901@sigill.intra.peff.net>
Jeff King wrote:
>   1. Does it still error on GIT_CONFIG=/nonexistent? I said then I
>      hadn't tested. I just did, and it does still produce an error.
Maybe it would make sense to squash in something like this, then.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index c703257..d0e5546 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -844,6 +844,27 @@ test_expect_success SYMLINKS 'symlinked configuration' '
 
 '
 
+test_expect_success 'nonexistent configuration' '
+	(
+		GIT_CONFIG=doesnotexist &&
+		export GIT_CONFIG &&
+		test_must_fail git config --list &&
+		test_must_fail git config test.xyzzy
+	)
+'
+
+test_expect_success SYMLINKS 'symlink to nonexistent configuration' '
+	ln -s doesnotexist linktonada &&
+	ln -s linktonada linktolinktonada &&
+	(
+		GIT_CONFIG=linktonada &&
+		export GIT_CONFIG &&
+		test_must_fail git config --list &&
+		GIT_CONFIG=linktolinktonada &&
+		test_must_fail git config --list
+	)
+'
+
 test_expect_success 'check split_cmdline return' "
 	git config alias.split-cmdline-fix 'echo \"' &&
 	test_must_fail git split-cmdline-fix &&
Previous: Jeff KingNext: Jeff King
Message 2 of 3 in “config: treat non-existent config files as empty”
  1. config: treat non-existent config files as emptyJeff King, Oct 21, 2010
  2. Jonathan NiederOct 21, 2010
  3. Jeff KingOct 21, 2010

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.