From a13d2c806104d246b79a179df84eb03e8b6b00e9 Mon Sep 17 00:00:00 2001 From: Davin Kevin Date: Mon, 22 Jul 2024 17:54:14 +0200 Subject: [PATCH] fix(config): manage case with branch with multiple `/` in their names Related to https://github.com/ejoffe/spr/issues/415 --- config/config_parser/remote_branch.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/config/config_parser/remote_branch.go b/config/config_parser/remote_branch.go index 45b89f5..6273cec 100644 --- a/config/config_parser/remote_branch.go +++ b/config/config_parser/remote_branch.go @@ -17,7 +17,7 @@ func NewRemoteBranchSource(gitcmd git.GitInterface) *remoteBranch { } } -var _remoteBranchRegex = regexp.MustCompile(`^## ([a-zA-Z0-9_\-/\.]+)\.\.\.([a-zA-Z0-9_\-/\.]+)/([a-zA-Z0-9_\-/\.]+)`) +var _remoteBranchRegex = regexp.MustCompile(`^## ([a-zA-Z0-9_\-/\.]+)\.\.\.([a-zA-Z0-9_\-\.]+)/([a-zA-Z0-9_\-/\.]+)`) func (s *remoteBranch) Load(cfg interface{}) { var output string @@ -32,5 +32,7 @@ func (s *remoteBranch) Load(cfg interface{}) { repoCfg := cfg.(*config.RepoConfig) repoCfg.GitHubRemote = matches[2] - repoCfg.GitHubBranch = matches[3] + if repoCfg.GitHubBranch == "" { + repoCfg.GitHubBranch = matches[3] + } }