forked from tangled.org/core
this repo has no description

knotserver/xrpc: fix total commit count in repo log

Signed-off-by: Anirudh Oppiliappan <anirudh@tangled.sh>

anirudh.fi 3ac1e08c 1ec70a31

verified
Changed files
+11 -1
knotserver
+11 -1
knotserver/xrpc/repo_log.go
··· 73 return 74 } 75 76 // Create response using existing types.RepoLogResponse 77 response := types.RepoLogResponse{ 78 Commits: commits, 79 Ref: ref, 80 Page: (offset / limit) + 1, 81 PerPage: limit, 82 - Total: len(commits), // This is not accurate for pagination, but matches existing behavior 83 } 84 85 if path != "" {
··· 73 return 74 } 75 76 + total, err := gr.TotalCommits() 77 + if err != nil { 78 + x.Logger.Error("fetching total commits", "error", err.Error()) 79 + writeError(w, xrpcerr.NewXrpcError( 80 + xrpcerr.WithTag("InternalServerError"), 81 + xrpcerr.WithMessage("failed to fetch total commits"), 82 + ), http.StatusNotFound) 83 + return 84 + } 85 + 86 // Create response using existing types.RepoLogResponse 87 response := types.RepoLogResponse{ 88 Commits: commits, 89 Ref: ref, 90 Page: (offset / limit) + 1, 91 PerPage: limit, 92 + Total: total, 93 } 94 95 if path != "" {