mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2026-03-16 01:19:02 +01:00
fix(bitbucketdatacenter): prevent adding new repos with empty branch (#5669)
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user