func (c *Commit) CommitsCount() (int64, error) { counter, result := history.MakeCounter(nil) hist := history.New(c.repo.repo) _, err := hist.WalkHistory(sha2oidp(c.ID), counter) if err != nil { return 0, err } return int64(result()), nil }
func (repo *Repository) fileCommitsCount(commit *Commit, file string) (int64, error) { pathCb := history.MakePathChecker(commit.repo.repo, file) cmp := history.MakePathComparator(commit.repo.repo, file) counter, result := history.MakeCounter(pathCb) hist := history.New(commit.repo.repo) _, err := hist.WalkFilteredHistory(sha2oidp(commit.ID), counter, cmp) if err != nil { return 0, err } return int64(result()), nil }