forked from forgejo/forgejo
Corrections following recommendations
This commit is contained in:
parent
81e5722bcc
commit
b7b30cd85e
5 changed files with 39 additions and 37 deletions
|
@ -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 {
|
Loading…
Add table
Add a link
Reference in a new issue