From a3e228257f4c100e7693062bcdecd23cbae45f99 Mon Sep 17 00:00:00 2001 From: Kristoffer Noga Date: Mon, 22 Dec 2025 10:46:34 +0100 Subject: [PATCH] allow tilde in patterns --- parse.go | 2 +- parse_test.go | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/parse.go b/parse.go index 60a7ac6..793c9a2 100644 --- a/parse.go +++ b/parse.go @@ -257,7 +257,7 @@ func isAlphanumeric(ch rune) bool { // isPatternChar matches characters that are allowed in patterns func isPatternChar(ch rune) bool { switch ch { - case '*', '?', '.', '/', '@', '_', '+', '-', '\\', '(', ')', '|', '{', '}': + case '*', '?', '.', '/', '@', '_', '+', '-', '\\', '(', ')', '|', '{', '}', '~': return true } return isAlphanumeric(ch) diff --git a/parse_test.go b/parse_test.go index 24ec8c8..6021e4a 100644 --- a/parse_test.go +++ b/parse_test.go @@ -273,6 +273,14 @@ func TestParseRule(t *testing.T) { Owners: []Owner{{Value: "org/team", Type: "team"}}, }, }, + { + name: "pattern with tilde '~'", + rule: "foobar~.txt @org/team", + expected: Rule{ + pattern: mustBuildPattern(t, "foobar~.txt"), + Owners: []Owner{{Value: "org/team", Type: "team"}}, + }, + }, // Error cases {