1
0
Fork 0
forked from forgejo/forgejo

Show branches in repo viewer

This commit is contained in:
Unknown 2014-03-16 23:43:22 -04:00
parent 7015c3d491
commit 685631627e
5 changed files with 43 additions and 17 deletions

View file

@ -8,7 +8,7 @@ import (
"path"
"time"
git "github.com/gogits/git"
"github.com/gogits/git"
)
type RepoFile struct {
@ -19,10 +19,26 @@ type RepoFile struct {
Size int64
}
func GetReposFiles(userName, reposName, branchName, rpath string) ([]*RepoFile, error) {
f := RepoPath(userName, reposName)
func GetBranches(userName, reposName string) ([]string, error) {
repo, err := git.OpenRepository(RepoPath(userName, reposName))
if err != nil {
return nil, err
}
repo, err := git.OpenRepository(f)
refs, err := repo.AllReferences()
if err != nil {
return nil, err
}
brs := make([]string, len(refs))
for i, ref := range refs {
brs[i] = ref.Name
}
return brs, nil
}
func GetReposFiles(userName, reposName, branchName, rpath string) ([]*RepoFile, error) {
repo, err := git.OpenRepository(RepoPath(userName, reposName))
if err != nil {
return nil, err
}