diff --git a/src/diff.rs b/src/diff.rs new file mode 100644 index 0000000000000000000000000000000000000000..07f5480241df0b9f557f15841ec986882604d439 --- /dev/null +++ b/src/diff.rs @@ -0,0 +1,18 @@ +use crate::checkout; +use crate::commit; + +pub fn compute_diff(commit1: &str, commit2: &Option<String>) { + let (borg_path, _) = commit::check_path(); + match commit2 { + Some(c2) => { + checkout::is_diff(commit1, c2, &borg_path); + } + None => { + // Create an archive with the content of the current commit + let tmp_name = format!("{}-tmp", commit1); + checkout::silent_commit(String::from("none"), tmp_name.clone(), false); + checkout::is_diff(&commit1, &tmp_name, &borg_path); + commit::delete_commit(&tmp_name, &borg_path); + } + } +}