Skip to content
Snippets Groups Projects
Commit 455ada31 authored by nfontrod's avatar nfontrod
Browse files

src/checkout.rs: change checkout to ignore some files

parent 397d04a0
No related branches found
No related tags found
No related merge requests found
...@@ -154,6 +154,7 @@ pub fn remove_results(borg_path: &PathBuf, results: &PathBuf) { ...@@ -154,6 +154,7 @@ pub fn remove_results(borg_path: &PathBuf, results: &PathBuf) {
/// Function that perform a checkout on your results /// Function that perform a checkout on your results
pub fn checkout(mode: &str) { pub fn checkout(mode: &str) {
let (borg_path, results) = commit::check_path(); let (borg_path, results) = commit::check_path();
let (has_ignore, borgignore) = commit::check_if_borgignore_exists(&borg_path);
if mode == "hard" { if mode == "hard" {
remove_results(&borg_path, &results) remove_results(&borg_path, &results)
} }
...@@ -180,10 +181,19 @@ pub fn checkout(mode: &str) { ...@@ -180,10 +181,19 @@ pub fn checkout(mode: &str) {
eprintln!("Extraction can only happen if you are at the root of your project folder"); eprintln!("Extraction can only happen if you are at the root of your project folder");
exit(47); exit(47);
} }
let mut output = Command::new("borg") let progress_part = match has_ignore {
.arg("extract") false => String::from("--progress"),
.arg("--progress") true => format!("--progress --exclude-from {}", borgignore.to_str().unwrap()),
.arg(format!("{}::{}", borg_path.to_str().unwrap(), commit_id)) };
let cmd = format!(
"borg extract {} {}::{}",
progress_part,
borg_path.to_str().unwrap(),
commit_id
);
let mut output = Command::new("sh")
.arg("-c")
.arg(cmd)
.stdout(Stdio::piped()) .stdout(Stdio::piped())
.spawn() .spawn()
.unwrap(); .unwrap();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment