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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---

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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux