summaryrefslogtreecommitdiff
path: root/src/git.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/git.rs')
-rw-r--r--src/git.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/git.rs b/src/git.rs
index d92b5a0..76ff326 100644
--- a/src/git.rs
+++ b/src/git.rs
@@ -234,6 +234,20 @@ pub fn set_branch(directory: &Path, branch: &str) -> Result<(), ShackleError> {
}
}
+pub fn housekeeping(directory: &Path) -> Result<(), ShackleError> {
+ if !is_valid_git_repo_path(directory)? {
+ return Err(ShackleError::InvalidDirectory);
+ }
+
+ Command::new("git")
+ .arg("gc")
+ .current_dir(directory)
+ .spawn()?
+ .wait()?;
+
+ Ok(())
+}
+
pub fn delete(directory: &Path) -> Result<(), ShackleError> {
if !is_valid_git_repo_path(directory)? {
return Err(ShackleError::InvalidDirectory);