From: Carl Smedstad <carl.smedstad@protonmail.com>
To: Derrick Stolee <derrickstolee@github.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] check-ignore: --non-matching without --verbose
Date: Tue, 24 May 2022 13:06:27 +0000 [thread overview]
Message-ID: <qzzAQ1fG52vlhFocoEqahGa8X0FRYpdAzxAHP6NwLXvMFuu0eZQzoa2ew3b1I31puAx__Cr3I2EZObON40rN0UWKT_rSXY3F0tuPqmh2aNc=@protonmail.com> (raw)
In-Reply-To: <362128ff-690d-8dc1-88fd-620f52b14d54@github.com>
> This may be better to indicate the behavior as predicated on the
> existence of --verbose:
>
> If `--verbose` is enabled, then all paths are listed along
> with an indicator (`::`) that no matching pattern was found.
> Without `--verbose`, list only the paths that do not match
> any pattern.
Good point. I've adopted you changes but made some slight changes to the first
line:
If `--verbose` is enabled, list both matching and non-matching
paths (non-matching paths along with the indicator `::`). Without
`--verbose`, list only the paths that do not match any pattern.
> These three blocks all call the same code line. So really you want
> to avoid a single case:
>
> if (!quiet &&
> ((verbose && (show_non_matching || pattern)) ||
> (!verbose && !!show_non_matching != !!pattern)))
>
> This is the most direct way to write what you had above. However,
> we could do this more simply:
>
> /* If --non-matching, then show if verbose or the pattern is missing. */
> if (!quiet && show_non_matching && (verbose || !pattern))
> output_pattern(...);
>
> /* If not --non-matching, then show if the pattern exists. */
> if (!quiet && !show_non_matching && pattern)
> output_pattern(...);
>
> Hopefully that's a bit easier to parse. I believe it is
> equivalent.
That is indeed equivalent and a lot easier to read. Implemented the changes in
full. Thanks!
next prev parent reply other threads:[~2022-05-24 13:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-23 12:54 [PATCH] check-ignore: --non-matching without --verbose Carl Smedstad via GitGitGadget
2022-05-23 18:14 ` Junio C Hamano
2022-05-24 13:03 ` Carl Smedstad
2022-05-24 19:18 ` Junio C Hamano
2022-05-24 19:26 ` Ævar Arnfjörð Bjarmason
2022-05-23 20:44 ` Derrick Stolee
2022-05-24 13:06 ` Carl Smedstad [this message]
2022-05-24 13:01 ` [PATCH v2] " Carl Smedstad via GitGitGadget
2022-05-24 17:45 ` [PATCH] " 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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='qzzAQ1fG52vlhFocoEqahGa8X0FRYpdAzxAHP6NwLXvMFuu0eZQzoa2ew3b1I31puAx__Cr3I2EZObON40rN0UWKT_rSXY3F0tuPqmh2aNc=@protonmail.com' \
--to=carl.smedstad@protonmail.com \
--cc=derrickstolee@github.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.
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).