diff --git a/scm/driver/bitbucket/git.go b/scm/driver/bitbucket/git.go index df16afbc..711a4d27 100644 --- a/scm/driver/bitbucket/git.go +++ b/scm/driver/bitbucket/git.go @@ -47,12 +47,17 @@ func (s *gitService) FindCommit(ctx context.Context, repo, ref string) (*scm.Com } var path string if strings.Contains(ref, "/") { - path = fmt.Sprintf("2.0/repositories/%s/?at=%s", repo, ref) + // path = fmt.Sprintf("2.0/repositories/%s/?at=%s", repo, ref) + path = fmt.Sprintf("2.0/repositories/%s/refs/tags/%s", repo, ref) + } else { path = fmt.Sprintf("2.0/repositories/%s/commit/%s", repo, ref) } out := new(commit) res, err := s.client.do(ctx, "GET", path, nil, out) + fmt.Println("FindCommit: res====", res) + fmt.Println("FindCommit: convertCommit(out====", convertCommit(out)) + return convertCommit(out), res, err } @@ -60,6 +65,8 @@ func (s *gitService) FindTag(ctx context.Context, repo, name string) (*scm.Refer path := fmt.Sprintf("2.0/repositories/%s/refs/tags/%s", repo, name) out := new(branch) res, err := s.client.do(ctx, "GET", path, nil, out) + fmt.Println("FindCommit: res444====", res) + return convertTag(out), res, err } diff --git a/scm/driver/stash/git.go b/scm/driver/stash/git.go index 221b5991..4730e7eb 100644 --- a/scm/driver/stash/git.go +++ b/scm/driver/stash/git.go @@ -51,6 +51,8 @@ func (s *gitService) FindCommit(ctx context.Context, repo, ref string) (*scm.Com path := fmt.Sprintf("rest/api/1.0/projects/%s/repos/%s/commits/%s", namespace, name, ref) out := new(commit) res, err := s.client.do(ctx, "GET", path, nil, out) + fmt.Println("FindCommit: res222====", res) + return convertCommit(out), res, err } @@ -67,6 +69,8 @@ func (s *gitService) FindTag(ctx context.Context, repo, tag string) (*scm.Refere return convertTag(v), res, err } } + fmt.Println("FindCommit: res333====", res) + return nil, res, scm.ErrNotFound }