From b3094bdb6f83b06d0dd7c90dd26d4443b8b49af2 Mon Sep 17 00:00:00 2001 From: Fontrodona Nicolas <nicolas.fontrodona@ens-lyon.fr> Date: Tue, 31 Jan 2023 17:14:35 +0100 Subject: [PATCH] src/commit.rs: add doc for check_path function --- src/commit.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/commit.rs b/src/commit.rs index 078c9c9..b37d9fa 100644 --- a/src/commit.rs +++ b/src/commit.rs @@ -1,10 +1,13 @@ -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(); -- GitLab