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

[RFC PATCH] t7508-status: fix a bogus check in a submodule-related test

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Aug 18, 2018, 17:56 UTC
Message-ID
<20180818175606.24108-1-szeder.dev@gmail.com>

Since 90e14525f2 (Add tests for the diff.ignoreSubmodules config option, 2010-08-06) the test '.gitmodules ignore=dirty suppresses submodules with untracked content' in 't7508-status.sh' contains a check that is bogus for two reasons.

The commit in question added the following three lines at the beginning of that test:

  git config diff.ignoreSubmodules dirty &&
  git status >output &&
  ! test -s actual &&
That 'test' is problematic, because:
  - The output of 'git status' is saved in the file 'output', but the
    subsequent 'test' looks at the file 'actual'.  This is the first
    mention of 'actual' in t7508, so that file doesn't exist at that
    point, and, consequently, the 'test' itself fails.  However, since
    there is a '!' in front to flip the exit code, the command as a
    whole succeeds.
    I guess that this 'test' should look at the file 'output' instead,
    but...
  - This whole command checks that the given file is empty, i.e. that,
    supposedly, 'git status' produced no output.  However, in this
    case 'git status' does produce output, and indeed it should
    produce the same output as already expected in the neighbouring
    tests or even later in the same test, all running 'git status' in
    similar situations.

So drop that bogus check, and verify that 'git status's output matches what's otherwise expected in similar cases.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
---

This is a submodules-related test, and I'm not very well versed in submodules, hence the RFC.

 t/t7508-status.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/t7508-status.sh b/t/t7508-status.sh
index e1f11293e2..4ea528785a 100755
--- a/t/t7508-status.sh
+++ b/t/t7508-status.sh
@@ -1183,7 +1183,7 @@ test_expect_success '--ignore-submodules=dirty suppresses submodules with untrac
 test_expect_success '.gitmodules ignore=dirty suppresses submodules with untracked content' '
 	test_config diff.ignoreSubmodules dirty &&
 	git status >output &&
-	! test -s actual &&
+	test_i18ncmp expect output &&
 	git config --add -f .gitmodules submodule.subname.ignore dirty &&
 	git config --add -f .gitmodules submodule.subname.path sm &&
 	git status >output &&
-- 
2.18.0.903.gab616d7dc6
Message 1 of 1 in “t7508-status: fix a bogus check in a submodule-related test”
  1. t7508-status: fix a bogus check in a submodule-related testSZEDER Gábor, Aug 18, 2018

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.