httpd: Fix commit count in repo stats in history route

Instead of using always the repo HEAD for the commit count with
`repo::stats` we should use `repo::stats_from` and pass the `parent`
commit.

This way we allow e.g. a commit history for a peer with lesser commits
to be counted correctly.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
Sebastian Martinez 2023-07-22 07:44:52 +02:00 committed by Alexis Sellier
parent a41f67d9ef
commit 0e0ff38ff7
No known key found for this signature in database
1 changed files with 1 additions and 1 deletions

View File

@ -206,7 +206,7 @@ async fn history_handler(
let response = json!({ let response = json!({
"commits": commits, "commits": commits,
"stats": repo.stats()?, "stats": repo.stats_from(&sha)?,
}); });
Ok::<_, Error>((StatusCode::OK, Json(response))) Ok::<_, Error>((StatusCode::OK, Json(response)))