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

Method load_with_vault_recorded

atomic-config/src/lib.rs:1131–1149  ·  view source on GitHub ↗

Load the repository configuration and report whether the shim vault policy (`[git.shim] vault`) was explicitly recorded, as opposed to defaulted by omission in a configuration written before the field existed. The distinction matters: an explicit record is a decision (the importer's first-import record, or a user's override) and wins; an omitted field is "undecided" and callers fall back to detec

(path: &std::path::Path)

Source from the content-addressed store, hash-verified

1129 /// Read and parse failures propagate — a corrupt configuration must
1130 /// fail closed, never silently change the resolved policy.
1131 pub fn load_with_vault_recorded(path: &std::path::Path) -> Result<(Self, bool), ConfigError> {
1132 if !path.exists() {
1133 return Ok((Self::default(), false));
1134 }
1135
1136 let content = std::fs::read_to_string(path).map_err(|e| ConfigError::ReadError {
1137 path: path.to_path_buf(),
1138 source: e,
1139 })?;
1140
1141 let value: toml::Value = toml::from_str(&content)?;
1142 let recorded = value
1143 .get("git")
1144 .and_then(|git| git.get("shim"))
1145 .and_then(|shim| shim.get("vault"))
1146 .is_some();
1147 let config: Self = toml::from_str(&content)?;
1148 Ok((config, recorded))
1149 }
1150
1151 /// Save repository configuration to a specific path.
1152 ///

Callers

nothing calls this directly

Calls 2

getMethod · 0.65
existsMethod · 0.45

Tested by

no test coverage detected