refactor: improved GitRepo assoc. function debug
Made the GitRepo associated functions easier to debug, by providing additional output of the struct when running the git command on the repo fails. Also removed commented out code in main. Signed-off-by: Christina Sørensen <christina@cafkafk.com>
This commit is contained in:
parent
cab7f72e28
commit
5e974e213d
2 changed files with 6 additions and 7 deletions
10
src/git.rs
10
src/git.rs
|
@ -99,7 +99,7 @@ impl GitRepo {
|
||||||
.arg(&self.url)
|
.arg(&self.url)
|
||||||
.arg(&self.name)
|
.arg(&self.name)
|
||||||
.status()
|
.status()
|
||||||
.unwrap_or_else(|_| panic!("git repo failed to add: {:?}", &self,));
|
.unwrap_or_else(|_| panic!("git repo failed to clone: {:?}", &self,));
|
||||||
info!("{out}");
|
info!("{out}");
|
||||||
} else {
|
} else {
|
||||||
info!("{} has clone set to false, not cloned", &self.name);
|
info!("{} has clone set to false, not cloned", &self.name);
|
||||||
|
@ -121,7 +121,7 @@ impl GitRepo {
|
||||||
.arg("add")
|
.arg("add")
|
||||||
.arg(".")
|
.arg(".")
|
||||||
.status()
|
.status()
|
||||||
.expect("failed to add");
|
.unwrap_or_else(|_| panic!("git repo failed to add: {:?}", &self,));
|
||||||
info!("{out}");
|
info!("{out}");
|
||||||
}
|
}
|
||||||
/// Tries to commit changes in the repository.
|
/// Tries to commit changes in the repository.
|
||||||
|
@ -131,7 +131,7 @@ impl GitRepo {
|
||||||
.current_dir(format!("{}{}", &self.path, &self.name))
|
.current_dir(format!("{}{}", &self.path, &self.name))
|
||||||
.arg("commit")
|
.arg("commit")
|
||||||
.status()
|
.status()
|
||||||
.expect("failed to commit");
|
.unwrap_or_else(|_| panic!("git repo failed to commit: {:?}", &self,));
|
||||||
info!("{out}");
|
info!("{out}");
|
||||||
}
|
}
|
||||||
/// Tries to commit changes with a message argument.
|
/// Tries to commit changes with a message argument.
|
||||||
|
@ -142,7 +142,7 @@ impl GitRepo {
|
||||||
.arg("-m")
|
.arg("-m")
|
||||||
.arg(msg)
|
.arg(msg)
|
||||||
.status()
|
.status()
|
||||||
.expect("failed to commit");
|
.unwrap_or_else(|_| panic!("git repo failed to commit: {:?}", &self,));
|
||||||
info!("{out}");
|
info!("{out}");
|
||||||
}
|
}
|
||||||
/// Attempts to push the repository.
|
/// Attempts to push the repository.
|
||||||
|
@ -151,7 +151,7 @@ impl GitRepo {
|
||||||
.current_dir(format!("{}{}", &self.path, &self.name))
|
.current_dir(format!("{}{}", &self.path, &self.name))
|
||||||
.arg("push")
|
.arg("push")
|
||||||
.status()
|
.status()
|
||||||
.expect("failed to push");
|
.unwrap_or_else(|_| panic!("git repo failed to push: {:?}", &self,));
|
||||||
info!("{out}");
|
info!("{out}");
|
||||||
}
|
}
|
||||||
/// Removes repository
|
/// Removes repository
|
||||||
|
|
|
@ -76,7 +76,6 @@ mod config {
|
||||||
use std::env::current_dir;
|
use std::env::current_dir;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
//use utils::dir::current_dir;
|
|
||||||
#[test]
|
#[test]
|
||||||
fn init_config() {
|
fn init_config() {
|
||||||
let _config = Config {
|
let _config = Config {
|
||||||
|
@ -178,7 +177,7 @@ mod config {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unable to test with networking inside flake
|
/* FIXME Unable to test with networking inside flake
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod repo_actions {
|
mod repo_actions {
|
||||||
use crate::*;
|
use crate::*;
|
||||||
|
|
Loading…
Reference in a new issue