mirror of
https://github.com/harness/drone.git
synced 2025-05-10 22:02:20 +08:00
Merge pull request #2733 from ilanpillemer/master
bitbucket needs to get ref via branch, cant via heads
This commit is contained in:
commit
1c87eba4ad
@ -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 New Issue
Block a user