Skip to content
Snippets Groups Projects
Verified Commit b3094bdb authored by nfontrod's avatar nfontrod
Browse files

src/commit.rs: add doc for check_path function

parent 4b2d46a9
Branches
No related tags found
No related merge requests found
use crate::{init, checkout};
use crate::{checkout, init};
use std::{
path::PathBuf,
process::{exit, Command, Stdio},
};
/// Check if .borg repository and results folder exists
/// # Return
/// - ` borg_folder`: Path to .borg folder
/// - `results_folder`: Path to the result folder
pub fn check_path() -> (PathBuf, PathBuf) {
let (borg_folder, results_folder) = init::get_borg_folder();
if !borg_folder.is_dir() {
......@@ -68,10 +71,9 @@ pub fn check_if_borgignore_exists(borg_folder: &PathBuf) -> (bool, PathBuf) {
(project_folder.is_file(), project_folder)
}
/// Function that checks if the archive with the name of the current commit id
/// exits in borg repository
pub fn is_a_commit(borg_path: &PathBuf, commit_id: &str) -> bool{
pub fn is_a_commit(borg_path: &PathBuf, commit_id: &str) -> bool {
// Trying to create an archive with the current git commit id
let output = Command::new("borg")
.arg("list")
......@@ -80,11 +82,10 @@ pub fn is_a_commit(borg_path: &PathBuf, commit_id: &str) -> bool{
.unwrap();
match output.status.code().unwrap() {
0 => true,
_ => false
_ => false,
}
}
/// Revert the result folder back to the current commit archive
pub fn revert_commit() {
let commit_id = get_current_commit();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment