mirror of
https://gitcode.com/gitea/gitea.git
synced 2025-05-22 17:48:23 +08:00
Fix count for commit graph last page (#8843)
* Fix count for commit graph last page * Remove used once variable * Move func to model * capitalize method name * fix error message
This commit is contained in:
@ -248,6 +248,16 @@ func CommitChanges(repoPath string, opts CommitChangesOptions) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// AllCommitsCount returns count of all commits in repository
|
||||
func AllCommitsCount(repoPath string) (int64, error) {
|
||||
stdout, err := NewCommand("rev-list", "--all", "--count").RunInDir(repoPath)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return strconv.ParseInt(strings.TrimSpace(stdout), 10, 64)
|
||||
}
|
||||
|
||||
func commitsCount(repoPath, revision, relpath string) (int64, error) {
|
||||
cmd := NewCommand("rev-list", "--count")
|
||||
cmd.AddArguments(revision)
|
||||
|
Reference in New Issue
Block a user