bitbucket needs to get ref via branch, cant via heads
This commit is contained in:
parent
3deb69886a
commit
c39ceb4ecb
1 changed files with 11 additions and 1 deletions
|
@ -16,7 +16,6 @@ package commit
|
|||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/drone/drone/core"
|
||||
"github.com/drone/go-scm/scm"
|
||||
)
|
||||
|
@ -77,6 +76,17 @@ func (s *service) FindRef(ctx context.Context, user *core.User, repo, ref string
|
|||
Token: user.Token,
|
||||
Refresh: user.Refresh,
|
||||
})
|
||||
|
||||
switch s.client.Driver {
|
||||
case scm.DriverBitbucket:
|
||||
ref = scm.TrimRef(ref)
|
||||
branch, _, err := s.client.Git.FindBranch(ctx, repo, ref) // wont work for a Tag
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ref = branch.Sha
|
||||
}
|
||||
|
||||
commit, _, err := s.client.Git.FindCommit(ctx, repo, ref)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Reference in a new issue