1
0
Fork 0
forked from forgejo/forgejo

Pass 'not' to commit count (#24473)

Due to #24409 , we can now specify '--not' when getting all commits from
a repo to exclude commits from a different branch.

When I wrote that PR, I forgot to also update the code that counts the
number of commits in the repo. So now, if the --not option is used, it
may return too many commits, which can indicate that another page of
data is available when it is not.

This PR passes --not to the commands that count the number of commits in
a repo
This commit is contained in:
Matthew Walowski 2023-05-08 00:10:53 -07:00 committed by GitHub
parent e962ade99c
commit ff5629268c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 177 additions and 30 deletions

View file

@ -208,7 +208,12 @@ func (r *Repository) GetCommitGraphsCount(ctx context.Context, hidePRRefs bool,
if len(branches) == 0 {
return git.AllCommitsCount(ctx, r.Repository.RepoPath(), hidePRRefs, files...)
}
return git.CommitsCountFiles(ctx, r.Repository.RepoPath(), branches, files)
return git.CommitsCount(ctx,
git.CommitsCountOptions{
RepoPath: r.Repository.RepoPath(),
Revision: branches,
RelPath: files,
})
})
}