summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo/commits.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/v1/repo/commits.go')
-rw-r--r--routers/api/v1/repo/commits.go27
1 files changed, 23 insertions, 4 deletions
diff --git a/routers/api/v1/repo/commits.go b/routers/api/v1/repo/commits.go
index 401403c83d..a5e2e7baef 100644
--- a/routers/api/v1/repo/commits.go
+++ b/routers/api/v1/repo/commits.go
@@ -146,6 +146,7 @@ func GetAllCommits(ctx *context.APIContext) {
sha := ctx.FormString("sha")
path := ctx.FormString("path")
+ not := ctx.FormString("not")
var (
commitsCountTotal int64
@@ -178,14 +179,18 @@ func GetAllCommits(ctx *context.APIContext) {
}
// Total commit count
- commitsCountTotal, err = baseCommit.CommitsCount()
+ commitsCountTotal, err = git.CommitsCount(ctx.Repo.GitRepo.Ctx, git.CommitsCountOptions{
+ RepoPath: ctx.Repo.GitRepo.Path,
+ Not: not,
+ Revision: []string{baseCommit.ID.String()},
+ })
+
if err != nil {
ctx.Error(http.StatusInternalServerError, "GetCommitsCount", err)
return
}
// Query commits
- not := ctx.FormString("not")
commits, err = baseCommit.CommitsByRange(listOptions.Page, listOptions.PageSize, not)
if err != nil {
ctx.Error(http.StatusInternalServerError, "CommitsByRange", err)
@@ -196,7 +201,14 @@ func GetAllCommits(ctx *context.APIContext) {
sha = ctx.Repo.Repository.DefaultBranch
}
- commitsCountTotal, err = ctx.Repo.GitRepo.FileCommitsCount(sha, path)
+ commitsCountTotal, err = git.CommitsCount(ctx,
+ git.CommitsCountOptions{
+ RepoPath: ctx.Repo.GitRepo.Path,
+ Not: not,
+ Revision: []string{sha},
+ RelPath: []string{path},
+ })
+
if err != nil {
ctx.Error(http.StatusInternalServerError, "FileCommitsCount", err)
return
@@ -205,7 +217,14 @@ func GetAllCommits(ctx *context.APIContext) {
return
}
- commits, err = ctx.Repo.GitRepo.CommitsByFileAndRange(sha, path, listOptions.Page)
+ commits, err = ctx.Repo.GitRepo.CommitsByFileAndRange(
+ git.CommitsByFileAndRangeOptions{
+ Revision: sha,
+ File: path,
+ Not: not,
+ Page: listOptions.Page,
+ })
+
if err != nil {
ctx.Error(http.StatusInternalServerError, "CommitsByFileAndRange", err)
return