git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [RFC PATCH] t7508-status: fix a bogus check in a submodule-related test
@ 2018-08-18 17:56 SZEDER Gábor
  0 siblings, 0 replies; only message in thread
From: SZEDER Gábor @ 2018-08-18 17:56 UTC (permalink / raw)
  To: git; +Cc: SZEDER Gábor, Jens Lehmann

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-08-18 17:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-18 17:56 [RFC PATCH] t7508-status: fix a bogus check in a submodule-related test SZEDER Gábor

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).