mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Corrections following recommendations
This commit is contained in:
@@ -288,9 +288,9 @@ func (repo *Repository) GetMirror() (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
func (repo *Repository) GetBranch(br string) (_ *Branch, err error) {
|
||||
func (repo *Repository) GetBranch(br string) (*Branch, error) {
|
||||
if(!git.IsBranchExist(repo.RepoPath(), br)){
|
||||
return nil, errors.New("Branch do not exist");
|
||||
return nil, fmt.Errorf("Branch does not exist: %s", br);
|
||||
}
|
||||
return &Branch{
|
||||
Path: repo.RepoPath(),
|
||||
@@ -298,7 +298,7 @@ func (repo *Repository) GetBranch(br string) (_ *Branch, err error) {
|
||||
},nil
|
||||
}
|
||||
|
||||
func (repo *Repository) GetBranches() (_ []*Branch, err error) {
|
||||
func (repo *Repository) GetBranches() ([]*Branch, error) {
|
||||
return GetBranchesByPath(repo.RepoPath())
|
||||
}
|
||||
|
||||
|
@@ -1,3 +1,7 @@
|
||||
// Copyright 2016 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package models
|
||||
|
||||
import (
|
||||
@@ -30,10 +34,6 @@ func GetBranchesByPath(path string) ([]*Branch, error) {
|
||||
return Branches, nil
|
||||
}
|
||||
|
||||
func GetBranchesByRepo(user,repo string) ([]*Branch, error) {
|
||||
return GetBranchesByPath(RepoPath(user, repo))
|
||||
}
|
||||
|
||||
func (br *Branch) GetCommit() (*git.Commit, error) {
|
||||
gitRepo, err := git.OpenRepository(br.Path)
|
||||
if err != nil {
|
Reference in New Issue
Block a user