mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2026-04-15 01:41:56 +00:00
Branch list enhancements (#808)
* Allow users not logged in to access branches page (fixes a nil pointer derefernce) * Add Gogs support for branches
This commit is contained in:
@@ -458,7 +458,11 @@ func (c *client) Activate(ctx context.Context, u *model.User, r *model.Repo, lin
|
||||
|
||||
// Branches returns the names of all branches for the named repository.
|
||||
func (c *client) Branches(ctx context.Context, u *model.User, r *model.Repo) ([]string, error) {
|
||||
client := c.newClientToken(ctx, u.Token)
|
||||
token := ""
|
||||
if u != nil {
|
||||
token = u.Token
|
||||
}
|
||||
client := c.newClientToken(ctx, token)
|
||||
|
||||
githubBranches, _, err := client.Repositories.ListBranches(ctx, r.Owner, r.Name, &github.BranchListOptions{})
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user