From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by dcvr.yhbt.net (Postfix) with ESMTP id 235FB1F4D7 for ; Tue, 24 May 2022 13:06:45 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (2048-bit key; secure) header.d=protonmail.com header.i=@protonmail.com header.b="ZLtsH3zU"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234109AbiEXNGm (ORCPT ); Tue, 24 May 2022 09:06:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232181AbiEXNGj (ORCPT ); Tue, 24 May 2022 09:06:39 -0400 Received: from mail-0301.mail-europe.com (mail-0301.mail-europe.com [188.165.51.139]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24115403E3 for ; Tue, 24 May 2022 06:06:38 -0700 (PDT) Date: Tue, 24 May 2022 13:06:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1653397594; x=1653656794; bh=uF1JzaamVn1vw8bUvjGBF78rKqfOxhKeUyDQ6DTzGYk=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:In-Reply-To: References:Feedback-ID:From:To:Cc:Date:Subject:Reply-To: Feedback-ID:Message-ID; b=ZLtsH3zUci9l9EGdn9ePRVUTEEyhXQewIhiRw5yiEwO7A2JxXNR0h6ZRrdl08qBmk nVSsjhWGUakHycQApaTQkljXiNWWwTefdywAvR1Qfbk114vV3EDG/NYQSt5fPwrIcO 9ZQ/dnF+b19DTo0DuTZaKVrD5+naBZbMNYePC/NvimmQ11Pt8MoW+nLCvSr7MNnReM 7pHPlns246EA8YNN0TDtADZdBCLD+pd8L3bTwi17JVFSPiq06XGm8bVTZVCyAIzAXV ruv1bXWGnh49DHF9gwEzFLFPITaiV0/o3PDdZCMsldtDxQMEUy/cInFqbk8egMq7D3 YEfNyfDIWbzWA== To: Derrick Stolee From: Carl Smedstad Cc: git@vger.kernel.org Reply-To: Carl Smedstad Subject: Re: [PATCH] check-ignore: --non-matching without --verbose Message-ID: In-Reply-To: <362128ff-690d-8dc1-88fd-620f52b14d54@github.com> References: <362128ff-690d-8dc1-88fd-620f52b14d54@github.com> Feedback-ID: 27944746:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org > This may be better to indicate the behavior as predicated on the > existence of --verbose: > > =09If `--verbose` is enabled, then all paths are listed along > =09with an indicator (`::`) that no matching pattern was found. > =09Without `--verbose`, list only the paths that do not match > =09any pattern. Good point. I've adopted you changes but made some slight changes to the fi= rst line: =09If `--verbose` is enabled, list both matching and non-matching =09paths (non-matching paths along with the indicator `::`). Without =09`--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: > > =09if (!quiet && > =09 ((verbose && (show_non_matching || pattern)) || > =09 (!verbose && !!show_non_matching !=3D !!pattern))) > > This is the most direct way to write what you had above. However, > we could do this more simply: > > =09/* If --non-matching, then show if verbose or the pattern is missing. = */ > =09if (!quiet && show_non_matching && (verbose || !pattern)) > =09=09output_pattern(...); > > =09/* If not --non-matching, then show if the pattern exists. */ > =09if (!quiet && !show_non_matching && pattern) > =09=09output_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!