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: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id D19681F5AE; Fri, 21 May 2021 09:52:14 +0000 (UTC) Date: Fri, 21 May 2021 09:52:14 +0000 From: Eric Wong To: Kyle Meyer Cc: meta@public-inbox.org Subject: Re: [PATCH] lei rediff: fix construction of git-diff options Message-ID: References: <20210521043816.23838-1-kyle@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210521043816.23838-1-kyle@kyleam.com> List-Id: Kyle Meyer wrote: > When generating git-diff options, lei-rediff extracts the single > character option from the lei option spec. However, there's no check > that the regular expression actually matches, leading to an > unintentional git-diff option when there isn't a short option (e.g., > --inter-hunk-context=1 maps to the invalid `git diff --color -w1'). > > Check for a match before trying to extract the single character > option. > > Fixes: cf0c7ce3ce81b5c3 (lei rediff: regenerate diffs from stdin) Oops :x Spending years in another language corrupted my mind to believe $1 gets clobbered on failed matches; but that's not the case for Perl. An unrelated patch I'm working on had the same problem :x Anyways, pushed as commit 3c1d0da4d0608b5a87371e602a911964d7c1498c Thanks.