summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-03-17 11:56:55 -0400
committerUnknown <joe2010xtmf@163.com>2014-03-17 11:56:55 -0400
commit9d3b003add6bee6cb23cbac5d32f6fb3d4fd50cb (patch)
tree92902b5a3026a2a9c4f43f7682a0d34a0b862365 /models
parent757e4f658c400d55eab6f11f1c39c1772cf615a7 (diff)
parentd6f3333e48fc7bc016e2385ee2fbe71262566958 (diff)
downloadgitea-9d3b003add6bee6cb23cbac5d32f6fb3d4fd50cb.tar.gz
gitea-9d3b003add6bee6cb23cbac5d32f6fb3d4fd50cb.zip
Merge branch 'master' of github.com:gogits/gogs
Diffstat (limited to 'models')
-rw-r--r--models/repo2.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/models/repo2.go b/models/repo2.go
index 91c057808b..8356c52de4 100644
--- a/models/repo2.go
+++ b/models/repo2.go
@@ -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()
+}