RFR: 1539: Allow dots in merge PR branch name

Kevin Rushforth kcr at openjdk.org
Thu Aug 11 14:17:39 UTC 2022


On Thu, 11 Aug 2022 14:05:32 GMT, Erik Joelsson <erikj at openjdk.org> wrote:

>> forge/src/main/java/org/openjdk/skara/forge/PullRequestUtils.java line 42:
>> 
>>> 40:     }
>>> 41: 
>>> 42:     private final static Pattern mergeSourcePattern = Pattern.compile("^Merge ([-/.\\w:+]+)$");
>> 
>> This will match any character, which may not be what you intend. Shouldn't that be `\.` instead of just `.`?
>
> My understanding is that the only characters you need to escape inside a character class are `^`, `-`, `]` or ``, everything else is a literal. Also Intellij gave me a warning when I tried to escape it saying it was unnecessary.

I stand corrected. I now see that `.` is a literal dot when it is inside `[]` (when not inside `[]` it matches any char).

-------------

PR: https://git.openjdk.org/skara/pull/1355


More information about the skara-dev mailing list