From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Emily Shaffer <nasamuffin@google.com>,
git@vger.kernel.org, git@jeffhostetler.com
Subject: Re: [PATCH] trace2: intercept all common signals
Date: Fri, 10 May 2024 18:20:30 -0400 [thread overview]
Message-ID: <20240510222030.GD1962678@coredump.intra.peff.net> (raw)
In-Reply-To: <xmqqle4h4d99.fsf@gitster.g>
On Fri, May 10, 2024 at 01:34:42PM -0700, Junio C Hamano wrote:
> Emily Shaffer <nasamuffin@google.com> writes:
>
> > While I'm at it, since you pointed out ! instead of test_must_fail, I
> > wondered if I should change "! test_grep" as well - but when I grep t/
> > it looks like it's not usual to use `test_must_fail test_grep`, but
> > instead to use `test_grep ! <omitted pattern> <file>`. I'll change
> > that too.
>
> "! test_grep" is an anti-pattern. We should have a documentation
> somewhere in t/README or nearby (if we don't, somebody please add
> one).
Better than documentation, maybe something like:
diff --git a/t/check-non-portable-shell.pl b/t/check-non-portable-shell.pl
index b2b28c2ced..7de2c30aa0 100755
--- a/t/check-non-portable-shell.pl
+++ b/t/check-non-portable-shell.pl
@@ -51,6 +51,7 @@ sub err {
err q(quote "$val" in 'local var=$val');
/^\s*([A-Z0-9_]+=(\w*|(["']).*?\3)\s+)+(\w+)/ and exists($func{$4}) and
err '"FOO=bar shell_func" assignment extends beyond "shell_func"';
+ /! test_grep/ and err 'do not invert test_* functions';
$line = '';
# this resets our $. for each file
close ARGV if eof;
There's at least one other case already. If you shorten it to just "!
test_" to catch more functions, you can see there are a lot of wrong
test_cmp invocations, too (maybe not quite as bad because we don't
produce a specific message, but we'd yield a confusing diff output).
But I think we can't cover everything; there are some like
test_have_prereq which obviously are invertible.
-Peff
next prev parent reply other threads:[~2024-05-10 22:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-10 17:22 [PATCH] trace2: intercept all common signals Emily Shaffer
2024-05-10 17:57 ` Emily Shaffer
2024-05-10 18:47 ` Junio C Hamano
2024-05-10 19:34 ` Emily Shaffer
2024-05-10 19:46 ` Jeff King
2024-05-10 19:49 ` Emily Shaffer
2024-05-10 20:05 ` Jeff King
2024-05-10 20:34 ` Junio C Hamano
2024-05-10 22:20 ` Jeff King [this message]
2024-05-10 19:41 ` Jeff King
2024-05-13 16:21 ` Emily Shaffer
2024-05-16 7:11 ` Jeff King
2024-05-16 16:32 ` Junio C Hamano
2024-05-23 9:36 ` Jeff King
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=20240510222030.GD1962678@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@jeffhostetler.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=nasamuffin@google.com \
/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).