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-25 12:34:03 +02:00
committed by Alexis Sellier
parent ed62ac4264
commit 3fcadc5058
+1 -1
View File
@@ -206,7 +206,7 @@ async fn history_handler(
let response = json!({
"commits": commits,
"stats": repo.stats()?,
"stats": repo.stats_from(&sha)?,
});
Ok::<_, Error>((StatusCode::OK, Json(response)))