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
Closes kemitix/git-next#100
44 lines
1.6 KiB
Rust
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");
|
|
}
|
|
}
|