1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

add commits

This commit is contained in:
Lunny Xiao
2014-03-17 23:04:49 +08:00
parent be8baea7ad
commit 45a6444b1e
4 changed files with 26 additions and 2 deletions

View File

@@ -191,3 +191,15 @@ func GetLastestCommit(userName, repoName string) (*Commit, error) {
}
return commit, nil
}
func GetCommits(userName, reposName, branchname string) ([]*git.Commit, error) {
repo, err := git.OpenRepository(RepoPath(userName, reposName))
if err != nil {
return nil, err
}
r, err := repo.LookupReference(fmt.Sprintf("refs/heads/%s", branchname))
if err != nil {
return nil, err
}
return r.AllCommits()
}