git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: git@vger.kernel.org
Cc: "SZEDER Gábor" <szeder.dev@gmail.com>,
	"Jens Lehmann" <Jens.Lehmann@web.de>
Subject: [RFC PATCH] t7508-status: fix a bogus check in a submodule-related test
Date: Sat, 18 Aug 2018 19:56:06 +0200	[thread overview]
Message-ID: <20180818175606.24108-1-szeder.dev@gmail.com> (raw)

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


                 reply	other threads:[~2018-08-18 17:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180818175606.24108-1-szeder.dev@gmail.com \
    --to=szeder.dev@gmail.com \
    --cc=Jens.Lehmann@web.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).