Skip to content
Snippets Groups Projects
Commit 397d04a0 authored by nfontrod's avatar nfontrod
Browse files

src/checkout.rs: diff skip some files based on borgignore

parent 915d48f7
No related branches found
No related tags found
No related merge requests found
......@@ -35,7 +35,16 @@ pub fn silent_commit(compression: String, mut commit_id: String, update: bool) {
/// Check if two commits are differents
pub fn is_diff(commit1: &str, commit2: &str, borg_folder: &PathBuf) -> bool {
let archive1 = format!("{}::{}", borg_folder.to_str().unwrap(), commit1);
let cmd = format!("borg diff {} {}", archive1, commit2);
let (has_ignore, borgignore) = commit::check_if_borgignore_exists(&borg_folder);
let cmd = match has_ignore {
false => format!("borg diff {} {}", archive1, commit2),
true => format!(
"borg diff --exclude-from {} {} {}",
borgignore.to_str().unwrap(),
archive1,
commit2
),
};
let output = Command::new("sh").arg("-c").arg(cmd).output().unwrap();
match output.status.code().unwrap() {
0 => (),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment