Skip to content
Snippets Groups Projects
Commit 8aac47a8 authored by nfontrod's avatar nfontrod
Browse files

src/diff.rs: add a diff subcommand to compute the difference between two commits

parent 8de84359
No related branches found
No related tags found
No related merge requests found
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);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment