aboutsummaryrefslogtreecommitdiff
path: root/models/repo_branch.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2017-03-11 01:43:45 -0500
committerUnknwon <u@gogs.io>2017-03-11 01:43:45 -0500
commit5c7cb1594b6904657bc63c50abc8b72056a85e4b (patch)
treef97e06b947ec12d039cd6fa0e3966a029ca6d44a /models/repo_branch.go
parent3eb57370a658a648ba504776b962d1d23cc57693 (diff)
repo/branches: overview and all (#2310)
Diffstat (limited to 'models/repo_branch.go')
-rw-r--r--models/repo_branch.go17
1 files changed, 10 insertions, 7 deletions
diff --git a/models/repo_branch.go b/models/repo_branch.go
index 369cb6c3..6c5b7ec8 100644
--- a/models/repo_branch.go
+++ b/models/repo_branch.go
@@ -15,8 +15,11 @@ import (
)
type Branch struct {
- Path string
- Name string
+ RepoPath string
+ Name string
+
+ IsProtected bool
+ Commit *git.Commit
}
func GetBranchesByPath(path string) ([]*Branch, error) {
@@ -33,8 +36,8 @@ func GetBranchesByPath(path string) ([]*Branch, error) {
branches := make([]*Branch, len(brs))
for i := range brs {
branches[i] = &Branch{
- Path: path,
- Name: brs[i],
+ RepoPath: path,
+ Name: brs[i],
}
}
return branches, nil
@@ -45,8 +48,8 @@ func (repo *Repository) GetBranch(br string) (*Branch, error) {
return nil, ErrBranchNotExist{br}
}
return &Branch{
- Path: repo.RepoPath(),
- Name: br,
+ RepoPath: repo.RepoPath(),
+ Name: br,
}, nil
}
@@ -55,7 +58,7 @@ func (repo *Repository) GetBranches() ([]*Branch, error) {
}
func (br *Branch) GetCommit() (*git.Commit, error) {
- gitRepo, err := git.OpenRepository(br.Path)
+ gitRepo, err := git.OpenRepository(br.RepoPath)
if err != nil {
return nil, err
}