From d2d49f353c8cd09ca75646ccba6b585921ed0c8a Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Thu, 11 Apr 2024 14:27:59 +0100 Subject: [PATCH] refactor: pass RepoDetails by reference --- src/server/actors/repo/status.rs | 7 +++---- src/server/forge/forgejo/mod.rs | 11 ++++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/server/actors/repo/status.rs b/src/server/actors/repo/status.rs index fce0ae44..82ed3fb2 100644 --- a/src/server/actors/repo/status.rs +++ b/src/server/actors/repo/status.rs @@ -18,7 +18,7 @@ pub async fn check_next( // get the status - pass, fail, pending (all others map to fail, e.g. error) let status = match repo_details.forge.forge_type { ForgeType::ForgeJo => { - forge::forgejo::get_commit_status(next.clone(), repo_details, net).await + forge::forgejo::get_commit_status(next.clone(), &repo_details, net).await } }; info!(?status, "Checking next branch status"); @@ -31,9 +31,8 @@ pub async fn check_next( } // TODO: (#22) wait and try again OR can webhook tell us when it's done, in // which case we can do nothing here and wait for the webhook to trigger Status::Fail => { - warn!("Check have failed"); - } // TODO: (#21) reset next and wait for dev to be updated and this - // commit removed from the commit history before trying again + warn!("Checks have failed"); + } } } diff --git a/src/server/forge/forgejo/mod.rs b/src/server/forge/forgejo/mod.rs index 4d4a002e..a5b45a4b 100644 --- a/src/server/forge/forgejo/mod.rs +++ b/src/server/forge/forgejo/mod.rs @@ -2,6 +2,7 @@ use kxio::network; use terrors::OneOf; use tracing::{error, info, warn}; +use crate::server; use crate::server::{actors::repo::status::Status, config::BranchName, forge}; use super::CommitHistories; @@ -9,8 +10,8 @@ use super::CommitHistories; pub mod config; pub async fn get_commit_histories( - repo_details: &crate::server::config::RepoDetails, - config: &crate::server::config::RepoConfig, + repo_details: &server::config::RepoDetails, + config: &server::config::RepoConfig, net: &kxio::network::Network, ) -> Result> { let main = (get_commit_history(repo_details, &config.branches().main(), None, net).await)?; @@ -30,9 +31,9 @@ pub async fn get_commit_histories( #[tracing::instrument(fields(%branch_name),skip_all)] async fn get_commit_history( - repo_details: &crate::server::config::RepoDetails, + repo_details: &server::config::RepoDetails, branch_name: &BranchName, - find_commit: Option<&forge::Commit>, // INFO: (#23) if [None] then get only one commit, if [Some] then get all commits up to this one or return an error + find_commit: Option<&forge::Commit>, net: &kxio::network::Network, ) -> Result, OneOf<(network::NetworkError,)>> { let hostname = &repo_details.forge.hostname; @@ -94,7 +95,7 @@ struct Commit { pub async fn get_commit_status( next: forge::Commit, - repo_details: crate::server::config::RepoDetails, + repo_details: &crate::server::config::RepoDetails, net: network::Network, ) -> Status { let hostname = &repo_details.forge.hostname;