You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Branch patterns with POSIX character classes like [[:digit:]] silently match the wrong branches #56
BranchPattern says it honours the same constructs as git's wildmatch for git branch --list (GitBranchStateCache/Refs/BranchPattern.cs:22-25). The #43 fix added ranges, sets, negation and escapes, but not POSIX character classes: [:alpha:], [:digit:], [:alnum:], [:upper:], [:lower:], [:space:], [:xdigit:], [:punct:] and the rest. git supports all of these.
In TryMatchBracket (BranchPattern.cs:190-214), the first ] after [[:digit: closes the bracket. The expression becomes the set { '[', ':', 'd', 'i', 'g', 't' } and the second ] is matched as a literal character.
Failure scenario
Pattern:origin/release-[[:digit:]]*
Branch:origin/release-1.0
Here: no match, because 1 is not in the set.
git:git branch --list 'release-[[:digit:]]*' lists the branch.
TryParse accepts the pattern, so /state and /branches return 200 with those branches missing. The client never hears about assets changed on them. The same pattern also wrongly matches a branch such as origin/release-d]x.
Suggested fix / acceptance criteria
In TryMatchBracket, recognise [:name:] as a bracket member and test the character with the matching ASCII predicate (char.IsAsciiDigit, char.IsAsciiLetter, and so on). Keep the linear walk with no regular expressions.
Reject an unknown class name such as [[:bogus:]] in TryParse with a 400, rather than letting it mismatch silently. git's wildmatch aborts the match in that case.
Add tests for [[:digit:]], [[:digit:]], [[:alpha:]_-], a mix like [a[:digit:]], and the malformed [[:bogus:]].
Update the remarks at BranchPattern.cs:22-25 to list the classes.
Suggested next step: add POSIX class parsing inside brackets, reject unknown classes with a 400, and add the listed tests. One nit: the test list names [[:digit:]] twice. The second one was probably meant to be another class, such as [[:alnum:]].
Activity
matt-edmondson commentedon Sep 28, 2026
Triage
[0-9]ranges.GitBranchStateCache/Refs/BranchPattern(TryMatchBracket,TryParse, remarks).[...]character classes match no branches, though git'sbranch --listhonours them #43, which added ranges, sets, negation and escapes.Suggested next step: add POSIX class parsing inside brackets, reject unknown classes with a 400, and add the listed tests. One nit: the test list names
[[:digit:]]twice. The second one was probably meant to be another class, such as[[:alnum:]].Generated by Claude Code