diff options
author | Justin Wernick <justin@worthe-it.co.za> | 2023-07-14 13:13:11 +0200 |
---|---|---|
committer | Justin Wernick <justin@worthe-it.co.za> | 2023-07-14 13:13:11 +0200 |
commit | 755e28d044aaff9a8aa0fa4700105564726ec33d (patch) | |
tree | 45eb98e20c340fc203737843cf43f766026d0c72 /src/git.rs | |
parent | 58664db6007920939d94977cc7382a5709b16558 (diff) |
Add a housekeeping task, which does git gc
Diffstat (limited to 'src/git.rs')
-rw-r--r-- | src/git.rs | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -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); |