use crate::GitError; use crate::hook::sync::HookMetaDataSync; use std::process::Command; impl HookMetaDataSync { pub async fn run_gc(&self) -> Result<(), GitError> { let storage_path = self.repo.storage_path.clone(); let logger = self.logger.clone(); tokio::task::spawn_blocking(move || { let status = Command::new("git") .arg("-C") .arg(&storage_path) .arg("gc") .arg("--auto") .arg("--quiet") .status() .map_err(|e| GitError::IoError(format!("git gc failed: {}", e)))?; if !status.success() { slog::warn!(logger, "git gc exited with {:?}", status.code()); } Ok::<(), GitError>(()) }) .await .map_err(|e| GitError::Internal(format!("spawn_blocking join error: {}", e)))? } }