Skip to content
Snippets Groups Projects
Commit 7a776597 authored by nfontrod's avatar nfontrod
Browse files

src/checkout.rs: temporary commit deletion using delete_commit function

parent 059914a2
No related branches found
No related tags found
No related merge requests found
...@@ -70,20 +70,9 @@ pub fn prepare_checkout() { ...@@ -70,20 +70,9 @@ pub fn prepare_checkout() {
check_if_current_commit_exits(&borg_path, &commit_id); check_if_current_commit_exits(&borg_path, &commit_id);
// Create an archive with the content of the current commit // Create an archive with the content of the current commit
let tmp_name = format!("{}-tmp", commit_id); let tmp_name = format!("{}-tmp", commit_id);
commit::commit(String::from("none"), tmp_name.clone()); commit::commit(String::from("none"), tmp_name.clone(), false);
let res = is_diff(&commit_id, &tmp_name, &borg_path); let res = is_diff(&commit_id, &tmp_name, &borg_path);
let output = Command::new("borg") commit::delete_commit(&tmp_name, &borg_path);
.arg("delete")
.arg(format!("{}::{}", borg_path.to_str().unwrap(), tmp_name))
.output()
.unwrap();
match output.status.code().unwrap() {
0 => (),
num => {
eprintln!("{}", String::from_utf8(output.stderr).unwrap());
exit(num);
}
}
if res { if res {
eprintln!("Your results folder contains unsaved changes!\nPlease update your current commit with: gbl commit --update"); eprintln!("Your results folder contains unsaved changes!\nPlease update your current commit with: gbl commit --update");
exit(4); exit(4);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment