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)
| 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`. |
| 239 | pub(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 | |
| 263 | pub(super) fn git_hook_context(root: &Path) -> CliResult<GitHookContext> { |
| 264 | let common_dir = match observe_git(root) |
no test coverage detected