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
No related branches found
No related tags found
No related merge requests found
use crate::{init, checkout}; use crate::{checkout, init};
use std::{ use std::{
path::PathBuf, path::PathBuf,
process::{exit, Command, Stdio}, process::{exit, Command, Stdio},
}; };
/// Check if .borg repository and results folder exists /// 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) { pub fn check_path() -> (PathBuf, PathBuf) {
let (borg_folder, results_folder) = init::get_borg_folder(); let (borg_folder, results_folder) = init::get_borg_folder();
if !borg_folder.is_dir() { if !borg_folder.is_dir() {
...@@ -68,7 +71,6 @@ pub fn check_if_borgignore_exists(borg_folder: &PathBuf) -> (bool, PathBuf) { ...@@ -68,7 +71,6 @@ pub fn check_if_borgignore_exists(borg_folder: &PathBuf) -> (bool, PathBuf) {
(project_folder.is_file(), project_folder) (project_folder.is_file(), project_folder)
} }
/// Function that checks if the archive with the name of the current commit id /// Function that checks if the archive with the name of the current commit id
/// exits in borg repository /// 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 {
...@@ -80,11 +82,10 @@ pub fn is_a_commit(borg_path: &PathBuf, commit_id: &str) -> bool{ ...@@ -80,11 +82,10 @@ pub fn is_a_commit(borg_path: &PathBuf, commit_id: &str) -> bool{
.unwrap(); .unwrap();
match output.status.code().unwrap() { match output.status.code().unwrap() {
0 => true, 0 => true,
_ => false _ => false,
} }
} }
/// Revert the result folder back to the current commit archive /// Revert the result folder back to the current commit archive
pub fn revert_commit() { pub fn revert_commit() {
let commit_id = get_current_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