mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Work on #476
This commit is contained in:
		@@ -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)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user