threads / rfc / 49159

RFC patcht7508-status: fix a bogus check in a submodule-related test

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

## tl;dr

One message between Aug 18, 2018 and Aug 18, 2018. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

SZEDER Gábor· Aug 18, 2018, 17:56 UTC · lore

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(-)
Show changes to t/t7508-status.sh +1 −1
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

← back to recent threads