Re: [PATCH] check-ignore: --non-matching without --verbose
- From
- Carl Smedstad <carl.smedstad@protonmail.com>
- Date
- May 24, 2022, 13:06 UTC
- Message-ID
- <qzzAQ1fG52vlhFocoEqahGa8X0FRYpdAzxAHP6NwLXvMFuu0eZQzoa2ew3b1I31puAx__Cr3I2EZObON40rN0UWKT_rSXY3F0tuPqmh2aNc=@protonmail.com>
- In-Reply-To
- <362128ff-690d-8dc1-88fd-620f52b14d54@github.com>
Show 7 quoted lines
> 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.
Show 20 quoted lines
> 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!