mirror of
https://github.com/harness/drone.git
synced 2025-05-10 22:21:22 +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 (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/drone/drone/core"
|
"github.com/drone/drone/core"
|
||||||
"github.com/drone/go-scm/scm"
|
"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,
|
Token: user.Token,
|
||||||
Refresh: user.Refresh,
|
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)
|
commit, _, err := s.client.Git.FindCommit(ctx, repo, ref)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
Reference in New Issue
Block a user