diff options
author | lunnyxiao <xiaolunwen@gmail.com> | 2014-09-17 12:04:18 +0800 |
---|---|---|
committer | lunnyxiao <xiaolunwen@gmail.com> | 2014-09-17 12:04:18 +0800 |
commit | 061a879cea39a1cce56dcb394b912fad50d7b77a (patch) | |
tree | 26e8c3d25da1b9d785421a6a02b7564798b2e8c4 /modules/git/repo_commit.go | |
parent | ed84adb679f3de70b2bffaead20a87711c38ee3a (diff) | |
parent | 9f015b4c73806e65d3ca085b76723dc8cf41eb02 (diff) |
Merge branch 'dev' of github.com:gogits/gogs into dev
Conflicts:
conf/app.ini
Diffstat (limited to 'modules/git/repo_commit.go')
-rw-r--r-- | modules/git/repo_commit.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/git/repo_commit.go b/modules/git/repo_commit.go index eebe3dd0..cd0181c4 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.LessThan(MustParseVersion("1.8.0")) { + 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) |