From 7c99c12a0e5004261827bba413598e2570764b2d Mon Sep 17 00:00:00 2001 From: "Sven A. Schmidt" Date: Fri, 28 Aug 2020 07:52:21 +0200 Subject: [PATCH] Allow numbers in branch name --- Sources/ArenaCore/Parser+ext.swift | 2 +- Tests/ArenaTests/ParserTests.swift | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Sources/ArenaCore/Parser+ext.swift b/Sources/ArenaCore/Parser+ext.swift index d97a8a6..45cb1d8 100644 --- a/Sources/ArenaCore/Parser+ext.swift +++ b/Sources/ArenaCore/Parser+ext.swift @@ -12,7 +12,7 @@ import SemanticVersion // https://mirrors.edge.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html -let AllowedBranchCharacters = CharacterSet.letters.union(CharacterSet(charactersIn: ".-@/")) +let AllowedBranchCharacters = CharacterSet.alphanumerics.union(CharacterSet(charactersIn: ".-@/")) let AllowedStartBranchCharacters = AllowedBranchCharacters.subtracting(CharacterSet(charactersIn: "/")) let AllowedEndBranchCharacters = AllowedBranchCharacters.subtracting(CharacterSet(charactersIn: "/.")) diff --git a/Tests/ArenaTests/ParserTests.swift b/Tests/ArenaTests/ParserTests.swift index b027822..5092d41 100644 --- a/Tests/ArenaTests/ParserTests.swift +++ b/Tests/ArenaTests/ParserTests.swift @@ -62,6 +62,11 @@ class ParserTests: XCTestCase { XCTAssertEqual(branchName.run("foo/"), Match(result: nil, rest: "foo/")) } + func test_parse_branchName_v5() throws { + // Test for issue https://github.com/finestructure/Arena/issues/62 + XCTAssertEqual(branchName.run("v5-develop"), Match(result: "v5-develop", rest: "")) + } + func test_parse_branch() { XCTAssertEqual(Parser.branch.run("@branch:develop"), Match(result: .branch("develop"), rest: "")) }