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

Function mirror_ignores_with_consent

atomic-cli/src/commands/git/hooks.rs:239–261  ·  view source on GitHub ↗

CB-11A: mirror unrepresented `.atomicignore` patterns into the managed `.git/info/exclude` block. This is the explicit-consent operation (RFC §9.4); it is only ever run when the user passes `--mirror-ignores`.

(root: &Path)

Source from the content-addressed store, hash-verified

237/// `.git/info/exclude` block. This is the explicit-consent operation (RFC
238/// §9.4); it is only ever run when the user passes `--mirror-ignores`.
239pub(crate) fn mirror_ignores_with_consent(root: &Path) -> CliResult<()> {
240 let root = canonical_root(root)?;
241 let before = atomic_repository::check_ignore_policy(&root)
242 .map_err(|error| git_error(format!("cannot inspect ignore policy: {error}")))?;
243 let report = atomic_repository::mirror_ignores(&root).map_err(|error| {
244 git_error(format!(
245 "cannot mirror .atomicignore into .git/info/exclude: {error}"
246 ))
247 })?;
248 let written = before.unmirrored.len() - report.unmirrored.len();
249 print_info(&format!(
250 "Covered {written} .atomicignore pattern(s) in Git ignore sources ({} newly mirrored into the managed .git/info/exclude block); {} unmirrored pattern(s) remain",
251 written,
252 report.unmirrored.len()
253 ));
254 if report.diverges() {
255 print_info(&format!(
256 "unmirrored (not representable verbatim): {}",
257 report.unmirrored.join(", ")
258 ));
259 }
260 Ok(())
261}
262
263pub(super) fn git_hook_context(root: &Path) -> CliResult<GitHookContext> {
264 let common_dir = match observe_git(root)

Callers 1

runMethod · 0.85

Calls 7

canonical_rootFunction · 0.85
check_ignore_policyFunction · 0.85
mirror_ignoresFunction · 0.85
print_infoFunction · 0.85
divergesMethod · 0.80
git_errorFunction · 0.70
lenMethod · 0.45

Tested by

no test coverage detected