git-next/crates/repo-actor/src/handlers/clone_repo.rs
Paul Campbell 9c20e780d0
All checks were successful
ci/woodpecker/cron/cron-docker-builder Pipeline was successful
ci/woodpecker/cron/push-next Pipeline was successful
ci/woodpecker/cron/tag-created Pipeline was successful
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
Rust / build (push) Successful in 1m34s
feat: update auth of interal repos when changed in config
Closes kemitix/git-next#100
2024-07-10 09:05:36 +01:00

44 lines
1.6 KiB
Rust

//
use actix::prelude::*;
use crate as actor;
use git_next_git as git;
impl Handler<actor::messages::CloneRepo> for actor::RepoActor {
type Result = ();
#[tracing::instrument(name = "RepoActor::CloneRepo", skip_all, fields(repo = %self.repo_details /*, gitdir = %self.repo_details.gitdir */))]
fn handle(
&mut self,
_msg: actor::messages::CloneRepo,
ctx: &mut Self::Context,
) -> Self::Result {
actor::logger(&self.log, "Handler: CloneRepo: start");
tracing::debug!("Handler: CloneRepo: start");
match git::repository::open(&*self.repository_factory, &self.repo_details) {
Ok(repository) => {
actor::logger(&self.log, "open okay");
tracing::debug!("open okay");
self.open_repository.replace(repository);
if self.repo_details.repo_config.is_none() {
actor::do_send(
ctx.address(),
actor::messages::LoadConfigFromRepo,
&self.log,
);
} else {
actor::do_send(
ctx.address(),
actor::messages::RegisterWebhook::new(),
&self.log,
);
}
}
Err(err) => {
actor::logger(&self.log, "open failed");
tracing::debug!("err: {err:?}");
tracing::warn!("Could not open repo: {err}")
}
}
tracing::debug!("Handler: CloneRepo: finish");
}
}