fix(git): add storage_path existence pre-check to run_fsck and run_gc
Some checks are pending
CI / Rust Lint & Check (push) Waiting to run
CI / Rust Tests (push) Waiting to run
CI / Frontend Lint & Type Check (push) Waiting to run
CI / Frontend Build (push) Blocked by required conditions

Consistent with run_sync: fail fast before blocking the thread pool
if the repo storage path does not exist on disk.
This commit is contained in:
ZhenYi 2026-04-16 22:24:14 +08:00
parent d26e947f8e
commit 329b526bfb

View File

@ -439,6 +439,12 @@ impl GitHookPool {
.map_err(crate::GitError::from)? .map_err(crate::GitError::from)?
.ok_or_else(|| crate::GitError::NotFound(format!("repo {} not found", repo_id)))?; .ok_or_else(|| crate::GitError::NotFound(format!("repo {} not found", repo_id)))?;
if !std::path::Path::new(&repo.storage_path).exists() {
return Err(crate::GitError::NotFound(format!(
"storage path does not exist: {}", repo.storage_path
)));
}
self.log_stream self.log_stream
.info(&task.id, &task.repo_id, "running fsck") .info(&task.id, &task.repo_id, "running fsck")
.await; .await;
@ -471,6 +477,12 @@ impl GitHookPool {
.map_err(crate::GitError::from)? .map_err(crate::GitError::from)?
.ok_or_else(|| crate::GitError::NotFound(format!("repo {} not found", repo_id)))?; .ok_or_else(|| crate::GitError::NotFound(format!("repo {} not found", repo_id)))?;
if !std::path::Path::new(&repo.storage_path).exists() {
return Err(crate::GitError::NotFound(format!(
"storage path does not exist: {}", repo.storage_path
)));
}
self.log_stream self.log_stream
.info(&task.id, &task.repo_id, "running gc") .info(&task.id, &task.repo_id, "running gc")
.await; .await;