summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorAntoine GIRARD <sapk@sapk.fr>2016-01-28 20:49:05 +0100
committerAntoine GIRARD <sapk@sapk.fr>2016-01-28 20:51:19 +0100
commitb7b30cd85e5cabd9d643013ffb10dafd133b18ea (patch)
tree64c950a4add6d9482d3dd4daebaea5e1839eb866 /models
parent81e5722bcc80e560f4e50874a9319f5c5fd3c0f3 (diff)
downloadgitea-b7b30cd85e5cabd9d643013ffb10dafd133b18ea.tar.gz
gitea-b7b30cd85e5cabd9d643013ffb10dafd133b18ea.zip
Corrections following recommendations
Diffstat (limited to 'models')
-rw-r--r--models/repo.go6
-rw-r--r--models/repo_branch.go (renamed from models/branch.go)8
2 files changed, 7 insertions, 7 deletions
diff --git a/models/repo.go b/models/repo.go
index 82fea00a6c..a0074a2953 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -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())
}
diff --git a/models/branch.go b/models/repo_branch.go
index 08b5b7c31d..b784f7d537 100644
--- a/models/branch.go
+++ b/models/repo_branch.go
@@ -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 {