Git Mailing List Archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH 2/3] t2021: do not negate test_path_is_dir
Date: Mon, 15 May 2023 19:26:45 -0700	[thread overview]
Message-ID: <20230516022646.648123-3-gitster@pobox.com> (raw)
In-Reply-To: <20230516022646.648123-1-gitster@pobox.com>

In this test, a path (some_dir) that is originally a directory is to
be removed and then to be replaced with a file of the same name.
The expectation is that the path becomes a file at the end.
However, "!  test_path_is_dir some_dir" is used to catch a breakage
that leaves the path as a directory.

But as with all the "test_path_is..." helpers, this use of the
helper makes it loud when the expectation (i.e. it is a directory)
is met, and otherwise is silent when it is not---this does not help
debugging.

Be more explicit and state that we expect the path to become a file.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t2021-checkout-overwrite.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t2021-checkout-overwrite.sh b/t/t2021-checkout-overwrite.sh
index 034f62c13c..ecfacf0f7f 100755
--- a/t/t2021-checkout-overwrite.sh
+++ b/t/t2021-checkout-overwrite.sh
@@ -77,7 +77,7 @@ test_expect_success 'checkout --overwrite-ignore should succeed if only ignored
 	echo autogenerated information >some_dir/ignore &&
 	echo ignore >.git/info/exclude &&
 	git checkout --overwrite-ignore df_conflict &&
-	! test_path_is_dir some_dir
+	test_path_is_file some_dir
 '
 
 test_done
-- 
2.41.0-rc0


  parent reply	other threads:[~2023-05-16  2:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-16  2:26 [PATCH 0/3] fix use of "! test_path_is_foo" in tests Junio C Hamano
2023-05-16  2:26 ` [PATCH 1/3] tests: do not negate test_path_exists Junio C Hamano
2023-05-16  2:53   ` Eric Sunshine
2023-05-16 16:10     ` Junio C Hamano
2023-05-16  2:26 ` Junio C Hamano [this message]
2023-05-16  2:26 ` [PATCH 3/3] test: do not negate test_path_is_* to assert absense Junio C Hamano

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=20230516022646.648123-3-gitster@pobox.com \
    --to=gitster@pobox.com \
    --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 read-only IMAP folder(s) and NNTP newsgroup(s).