Skip to content

Commit 62c5aad

Browse files
Inline check for slash in branch name
1 parent 58a95f4 commit 62c5aad

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

scm/driver/bitbucket/linker.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package bitbucket
77
import (
88
"context"
99
"fmt"
10+
"strings"
1011

1112
"github.com/drone/go-scm/scm"
1213
)
@@ -33,7 +34,7 @@ func (l *linker) Resource(ctx context.Context, repo string, ref scm.Reference) (
3334
// a slash so we do this for branches with slashes in its names.
3435
// See https://jira.atlassian.com/browse/BCLOUD-14422 for more information
3536
//
36-
if scm.BranchContainsSlash(t) {
37+
if strings.Contains(t, "/") {
3738
return fmt.Sprintf("%s%s/branch/%s", l.base, repo, t), nil
3839
}
3940

scm/util.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,3 @@ func IsPullRequest(ref string) bool {
7777
strings.HasPrefix(ref, "refs/pull-request/") ||
7878
strings.HasPrefix(ref, "refs/merge-requests/")
7979
}
80-
81-
// BranchContainsSlash returns true if the branch name
82-
// contains a slash.
83-
func BranchContainsSlash(branch string) bool {
84-
return strings.Contains(branch, "/")
85-
}

0 commit comments

Comments
 (0)