Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
git_borg_linker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LBMC
Hub
git_borg_linker
Commits
b3094bdb
Verified
Commit
b3094bdb
authored
2 years ago
by
nfontrod
Browse files
Options
Downloads
Patches
Plain Diff
src/commit.rs: add doc for check_path function
parent
4b2d46a9
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/commit.rs
+6
-5
6 additions, 5 deletions
src/commit.rs
with
6 additions
and
5 deletions
src/commit.rs
+
6
−
5
View file @
b3094bdb
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
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment