From 0e0ff38ff7c1bd57f343432cff6001c414b2154b Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Sat, 22 Jul 2023 07:44:52 +0200 Subject: [PATCH] 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 --- radicle-httpd/src/api/v1/projects.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radicle-httpd/src/api/v1/projects.rs b/radicle-httpd/src/api/v1/projects.rs index b362300d..95574405 100644 --- a/radicle-httpd/src/api/v1/projects.rs +++ b/radicle-httpd/src/api/v1/projects.rs @@ -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)))