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

[PATCH 2/3] t1300: remove duplicate test for `--file no-such-file`

From
MÅMartin Ågren <martin.agren@gmail.com>
Date
Jan 3, 2021, 09:36 UTC
Message-ID
<20210103093649.2221-3-martin.agren@gmail.com>
In-Reply-To
<20210103093649.2221-1-martin.agren@gmail.com>

We test that we can handle `git config --file symlink` and the error case of `git config --file symlink-to-missing-file`. For good measure, we also throw in a test to check that we correctly handle referencing a missing regular file. But we have such a test earlier in this script. They both check that we fail to use `--file no-such-file --list`.

Drop the latter of these and keep the one that is in the general area where we test `--file` and `GIT_CONFIG`. The one we're dropping also checks that we can't even get a specific key from the missing file -- let's make sure we check that in the test we keep.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
---
 t/t1300-config.sh | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/t/t1300-config.sh b/t/t1300-config.sh
index 302821fb02..1439d870d6 100755
--- a/t/t1300-config.sh
+++ b/t/t1300-config.sh
@@ -469,7 +469,8 @@ test_expect_success 'new variable inserts into proper section' '
 '
 
 test_expect_success 'alternative --file (non-existing file should fail)' '
-	test_must_fail git config --file non-existing-config -l
+	test_must_fail git config --file non-existing-config -l &&
+	test_must_fail git config --file non-existing-config test.xyzzy
 '
 
 cat > other-config << EOF
@@ -1032,11 +1033,6 @@ test_expect_success SYMLINKS 'symlinked configuration' '
 	test_cmp expect actual
 '
 
-test_expect_success 'nonexistent configuration' '
-	test_must_fail git config --file=doesnotexist --list &&
-	test_must_fail git config --file=doesnotexist test.xyzzy
-'
-
 test_expect_success SYMLINKS 'symlink to nonexistent configuration' '
 	ln -s doesnotexist linktonada &&
 	ln -s linktonada linktolinktonada &&
-- 
2.30.0
Previous: Martin ÅgrenNext: Martin Ågren
Message 3 of 5 in “t1300: minor cleanups”
  1. 0/3 t1300: minor cleanupsMartin Ågren, Jan 3, 2021
  2. 1/3 t1300: remove duplicate test for `--file ../foo`Martin Ågren, Jan 3, 2021
  3. 2/3 t1300: remove duplicate test for `--file no-such-file`Martin Ågren, Jan 3, 2021
  4. 3/3 t1300: don't needlessly work with `core.foo` configsMartin Ågren, Jan 3, 2021
  5. Junio C HamanoJan 6, 2021

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.