aboutsummaryrefslogtreecommitdiffstats
path: root/modules/git/repo_commit.go
diff options
context:
space:
mode:
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)