Fix Bitbucket Server branches (#1698)

Closes #1695
This commit is contained in:
qwerty287 2023-04-07 18:09:17 +02:00 committed by GitHub
parent 0fb978fa98
commit 4b4d078377
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions

View file

@ -43,7 +43,7 @@ const (
pathHookEnabled = "%s/rest/api/1.0/projects/%s/repos/%s/settings/hooks/%s/enabled"
pathHookSettings = "%s/rest/api/1.0/projects/%s/repos/%s/settings/hooks/%s/settings"
pathStatus = "%s/rest/build-status/1.0/commits/%s"
pathBranches = "%s/2.0/repositories/%s/%s/refs/branches"
pathBranches = "%s/rest/api/1.0/projects/%s/repos/%s/branches"
)
type Client struct {
@ -326,12 +326,10 @@ func (c *Client) paginatedRepos(start int) ([]*Repo, error) {
func (c *Client) ListBranches(owner, name string) ([]*Branch, error) {
uri := fmt.Sprintf(pathBranches, c.base, owner, name)
response, err := c.doGet(uri)
if response != nil {
defer response.Body.Close()
}
if err != nil {
return nil, err
}
defer response.Body.Close()
out := new(BranchResp)
err = json.NewDecoder(response.Body).Decode(&out)
return out.Values, err

View file

@ -211,5 +211,5 @@ type BranchResp struct {
}
type Branch struct {
Name string `json:"name"`
Name string `json:"displayId"`
}