- Remove all use slog::* imports and log: slog::Logger fields
- ssh/handle.rs: replace slog macro chains with tracing::{info!, warn!,
error!, debug!}; remove log field from GitSshHandle
- ssh/authz.rs, ssh/mod.rs, ssh/server.rs: remove slog Logger fields
- http/: auth.rs, handler.rs, mod.rs, routes.rs: remove slog usage
- hook/: pool worker, sync modules, webhook_dispatch.rs: remove slog
31 lines
1.0 KiB
Rust
31 lines
1.0 KiB
Rust
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();
|
|
|
|
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() {
|
|
// git gc --auto exits non-zero when there's nothing to collect,
|
|
// or when another gc is already running — both are benign.
|
|
tracing::warn!(code = ?status.code(), "git gc exited with non-zero status");
|
|
}
|
|
|
|
Ok::<(), GitError>(())
|
|
})
|
|
.await
|
|
.map_err(|e| GitError::Internal(format!("spawn_blocking join error: {}", e)))?
|
|
}
|
|
}
|