Subject: Re: [PATCH] cvsserver: avoid precedence problem between ! and %s

From: Junio C Hamano <[email-masked]>
Date: Wed, 21 May 2025 07:58:07 -0700

"Ondřej Pohořelský via GitGitGadget" <[email-masked]>
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?

>      {
>          $refName=~s/_-/_-u--/g;
>          $refName=~s/\./_-p-/g;
>
> base-commit: cb96e1697ad6e54d11fc920c95f82977f8e438f8