summaryrefslogtreecommitdiffstats
path: root/modules/git/repo_commit.go
diff options
context:
space:
mode:
authorUnknwon <joe2010xtmf@163.com>2014-09-16 10:10:33 -0400
committerUnknwon <joe2010xtmf@163.com>2014-09-16 10:10:33 -0400
commit0d9c41be7d7d4ae1d2a28931be5565c8f6d3f792 (patch)
treef8fcb8c01547a7f259917bc4050a2620bca58a9d /modules/git/repo_commit.go
parentc1ceec45da8c600dea2b932127519c04484258d8 (diff)
downloadgitea-0d9c41be7d7d4ae1d2a28931be5565c8f6d3f792.tar.gz
gitea-0d9c41be7d7d4ae1d2a28931be5565c8f6d3f792.zip
Work on #476
Diffstat (limited to 'modules/git/repo_commit.go')
-rw-r--r--modules/git/repo_commit.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/git/repo_commit.go b/modules/git/repo_commit.go
index eebe3dd0e0..c9258927bb 100644
--- a/modules/git/repo_commit.go
+++ b/modules/git/repo_commit.go
@@ -137,6 +137,14 @@ func (repo *Repository) GetCommit(commitId string) (*Commit, error) {
}
func (repo *Repository) commitsCount(id sha1) (int, error) {
+ if gitVer.Compare(MustParseVersion("1.8.0")) == -1 {
+ stdout, stderr, err := com.ExecCmdDirBytes(repo.Path, "git", "log", "--pretty=format:''", id.String())
+ if err != nil {
+ return 0, errors.New(string(stderr))
+ }
+ return len(bytes.Split(stdout, []byte("\n"))), nil
+ }
+
stdout, stderr, err := com.ExecCmdDir(repo.Path, "git", "rev-list", "--count", id.String())
if err != nil {
return 0, errors.New(stderr)