aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmd/git-extract-issue/main.go
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-11-27 02:52:28 +0900
committernsfisis <nsfisis@gmail.com>2025-11-27 02:52:28 +0900
commit0dc4922fd188cfc3846be29fd2e2d777297e034c (patch)
tree562b53638bdfc2f172854f9429adadbb4d960d27 /cmd/git-extract-issue/main.go
parentb61815b7499e7286e88d7de9fe667af08ab66f55 (diff)
downloadgit-helpers-0dc4922fd188cfc3846be29fd2e2d777297e034c.tar.gz
git-helpers-0dc4922fd188cfc3846be29fd2e2d777297e034c.tar.zst
git-helpers-0dc4922fd188cfc3846be29fd2e2d777297e034c.zip
fix handling of number suffixv0.1.1
Diffstat (limited to 'cmd/git-extract-issue/main.go')
-rw-r--r--cmd/git-extract-issue/main.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/cmd/git-extract-issue/main.go b/cmd/git-extract-issue/main.go
index 4681d4d..2e9255d 100644
--- a/cmd/git-extract-issue/main.go
+++ b/cmd/git-extract-issue/main.go
@@ -20,10 +20,11 @@ func main() {
// * 123-suffix => #123
// * feature/123 => #123
// * feature/123-suffix => #123
+// * feature/123-2 => #123
// * feature/prefix-123 => prefix-123
// * feature/prefix-123-suffix => prefix-123
func extractIssueNumberFromBranchName(branchName string) string {
- pattern := regexp.MustCompile(`\A(?:\w+/)?(\w+-)?(\d+)(?:-\w+)*\z`)
+ pattern := regexp.MustCompile(`\A(?:\w+/)?([A-Za-z][0-9A-Za-z]*-)?(\d+)(?:-\w+)*\z`)
matches := pattern.FindSubmatch([]byte(branchName))
if len(matches) != 3 {
return ""