fix(bitbucketdatacenter): prevent adding new repos with empty branch (#5669)

This commit is contained in:
Henrik Huitti
2025-10-22 09:19:20 +03:00
committed by GitHub
parent 4d03bd218d
commit f9380cdf01

View File

@@ -16,6 +16,7 @@ package bitbucketdatacenter
import (
"context"
"errors"
"fmt"
"net/http"
"net/url"
@@ -202,6 +203,10 @@ func (c *client) Repo(ctx context.Context, u *model.User, rID model.ForgeRemoteI
return nil, fmt.Errorf("unable to fetch default branch: %w", err)
}
if b.DisplayID == "" {
return nil, errors.New("default branch setting does not exist")
}
perms := &model.Perm{Pull: true, Push: true}
_, _, err = bc.Projects.ListWebhooks(ctx, repo.Project.Key, repo.Slug, &bb.ListOptions{})
if err == nil {