Re: [PATCH] cvsserver: avoid precedence problem between ! and %s
- From
brian m. carlson <sandals@crustytoothpaste.net>
- Date
- May 21, 2025, 21:48 UTC
- Message-ID
- <aC5KRBop9m3K5JtE@tapette.crustytoothpaste.net>
- In-Reply-To
- <xmqqplg2c8ow.fsf@gitster.g>
On 2025-05-21 at 14:58:07, Junio C Hamano wrote:
Show 16 quoted lines
> "Ondřej Pohořelský via GitGitGadget" <gitgitgadget@gmail.com> > writes: > > > diff --git a/git-cvsserver.perl b/git-cvsserver.perl > > index a4e1bad33ca..076c10cb2c2 100755 > > --- a/git-cvsserver.perl > > +++ b/git-cvsserver.perl > > @@ -5009,7 +5009,7 @@ sub escapeRefName > > # = "_-xx-" Where "xx" is the hexadecimal representation of the > > # desired ASCII character byte. (for anything else) > > > > - if(! $refName=~/^[1-9][0-9]*(\.[1-9][0-9]*)*$/) > > + if(! ($refName=~/^[1-9][0-9]*(\.[1-9][0-9]*)*$/)) > > Interesting. Shouldn't it be using !~ instead if it wants to assert > that the refname does not match the pattern?
Yes, it should. It's likely the reason this is getting a warning is that `!` is higher precedence than `=~` and `!~` (see `man perlop`) and switching to `!~` is the customary way of writing this.
-- brian m. carlson (they/them) Toronto, Ontario, CA