MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / read_shim_config

Function read_shim_config

atomic-cli/src/commands/diagnostics/collect.rs:1295–1308  ·  view source on GitHub ↗
(root: &Path)

Source from the content-addressed store, hash-verified

1293}
1294
1295fn read_shim_config(root: &Path) -> Result<atomic_config::RepoConfig, ShimConfigError> {
1296 let dir = atomic_repository::Repository::canonical_dot_dir(root)
1297 .map_err(|_| ShimConfigError::Location)?;
1298 // Reading directly avoids `Path::exists` treating access errors as an
1299 // absent config, while preserving the default for a genuinely missing file.
1300 let path = dir.join("config.toml");
1301 match std::fs::read_to_string(&path) {
1302 Ok(text) => toml::from_str(&text).map_err(|_| ShimConfigError::Parse),
1303 Err(error) if error.kind() == ErrorKind::NotFound && demonstrably_missing(&path) => {
1304 Ok(Default::default())
1305 }
1306 Err(error) => Err(ShimConfigError::Read(error.kind())),
1307 }
1308}
1309
1310fn collect_git_shim(
1311 workspace: &Result<Option<PathBuf>, SourceError>,

Callers 1

collect_git_shimFunction · 0.85

Calls 2

demonstrably_missingFunction · 0.85
kindMethod · 0.45

Tested by

no test coverage detected