diff --git a/src/main.rs b/src/main.rs index 0ac23d8..243ceb3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -39,7 +39,11 @@ struct Args { )] create: bool, - #[arg(short = 's', long, help = "Exit on push errors instead of ignoring")] + #[arg( + short = 's', + long, + help = "Exit on push and unknown host errors instead of ignoring them" + )] strict: bool, } diff --git a/src/refractr.rs b/src/refractr.rs index 835e84a..b20511c 100644 --- a/src/refractr.rs +++ b/src/refractr.rs @@ -36,6 +36,7 @@ struct OpenedRepository { path: String, remotes: Vec, cfg: Config, + ssh: bool, } impl Refractr { @@ -287,6 +288,18 @@ impl Refractr { 2, format!("Interval for {} has arrived, pulling", repos[i].cfg.from), ); + if let Err(e) = self.fetch( + &repos[i].repo, + &repos[i].cfg.branches, + repos[i].ssh, + &repos[i].cfg.git.ssh_identity_file, + self.strict.clone(), + ) { + common::error( + format!("failed to fetch repo {}: {}", repos[i].cfg.from, e), + ExitCode::FetchError, + ); + } let _ = self.fast_forward(&repos[i].path, &repos[i].cfg.branches); if let Err(e) = self.push_remotes(&repos[i].cfg, &repos[i].repo, &repos[i].remotes) { @@ -452,6 +465,7 @@ impl Refractr { path: repo_dir, remotes, cfg: cfg.config, + ssh, }); } }