diff --git a/crates/walgit-config/src/lib.rs b/crates/walgit-config/src/lib.rs index e3cdaf15..dbea88f5 100644 --- a/crates/walgit-config/src/lib.rs +++ b/crates/walgit-config/src/lib.rs @@ -1079,6 +1079,10 @@ impl Config { pub fn validate(&self) -> Result<()> { self.refs.validate()?; self.packs.validate()?; + anyhow::ensure!( + self.server.max_concurrent_per_repo > 0, + "server.max_concurrent_per_repo must be positive" + ); anyhow::ensure!( self.packfile_uri.uri_min_bytes.as_u64() > 0, "packfile_uri.uri_min_bytes must be positive" @@ -1354,6 +1358,14 @@ mod tests { assert_eq!(back.store.bucket, c.store.bucket); } + #[test] + fn zero_per_repo_concurrency_is_rejected() { + let mut c = Config::default(); + c.server.max_concurrent_per_repo = 0; + let err = c.validate().unwrap_err().to_string(); + assert!(err.contains("server.max_concurrent_per_repo must be positive")); + } + #[test] fn example_configurations_parse_and_validate() { Config::parse(include_str!("../../../walgit.example.toml")).unwrap();