`baseline_ref` names the ref the projection commits onto; its tip is the Git state a marker must be new against (HEAD when the ref is absent).
(
repo: &Repository,
git_repo: &GitRepository,
baseline_ref: Option<&str>,
repo_root: &Path,
view: &str,
)
| 2018 | /// `baseline_ref` names the ref the projection commits onto; its tip is the |
| 2019 | /// Git state a marker must be new against (HEAD when the ref is absent). |
| 2020 | fn refuse_conflict_markers( |
| 2021 | repo: &Repository, |
| 2022 | git_repo: &GitRepository, |
| 2023 | baseline_ref: Option<&str>, |
| 2024 | repo_root: &Path, |
| 2025 | view: &str, |
| 2026 | ) -> CliResult<()> { |
| 2027 | let working_copy = repo |
| 2028 | .require_working_copy_id() |
| 2029 | .map_err(CliError::Repository)?; |
| 2030 | let marker = repo |
| 2031 | .first_working_copy_conflict_marker(working_copy) |
| 2032 | .map_err(CliError::Repository)?; |
| 2033 | // Review ::26 R5: the status-filtered scan above cannot see a file whose |
| 2034 | // RECORDED state carries markers (a record made with |
| 2035 | // --allow-conflict-markers leaves the status clean while the view's |
| 2036 | // canonical content still holds the markers). The switch/shadow boundary |
| 2037 | // therefore ALSO scans the materialized view content: unresolved markers |
| 2038 | // must never become Git evidence, whatever their worktree status. |
| 2039 | // |
| 2040 | // Markers the baseline commit already holds byte-for-byte are not this |
| 2041 | // commit's doing (llmlang: a dependabot merge committed `Cargo.lock` |
| 2042 | // with its markers; every later `atomic record` of an unrelated file was |
| 2043 | // refused here AFTER the record had landed, leaving Git behind Atomic |
| 2044 | // for good). Only a file whose projected bytes the baseline does not |
| 2045 | // hold can introduce or keep an unresolved marker. |
| 2046 | let baseline = baseline_tree(git_repo, baseline_ref); |
| 2047 | let marker = marker.or_else(|| { |
| 2048 | repo.first_view_conflict_marker_where(working_copy, &|path, content| { |
| 2049 | !baseline |
| 2050 | .as_ref() |
| 2051 | .is_some_and(|tree| tree_holds_bytes(git_repo, tree, path, content)) |
| 2052 | }) |
| 2053 | .map_err(CliError::Repository) |
| 2054 | .ok() |
| 2055 | .flatten() |
| 2056 | }); |
| 2057 | let Some((path, line)) = marker else { |
| 2058 | return Ok(()); |
| 2059 | }; |
| 2060 | if !std::io::stderr().is_terminal() { |
| 2061 | append_shadow_validate_log( |
| 2062 | repo_root, |
| 2063 | "V1", |
| 2064 | view, |
| 2065 | &format!("file={} line={}", path, line), |
| 2066 | ); |
| 2067 | } |
| 2068 | print_warning(&format!( |
| 2069 | "Refusing to commit '{}': unresolved conflict marker at line {}.", |
| 2070 | path, line |
| 2071 | )); |
| 2072 | Err(CliError::GitError { |
| 2073 | message: format!( |
| 2074 | "'{}' still contains conflict markers at line {} — resolve the conflict \ |
| 2075 | (remove the >>>>>>> / ======= / <<<<<<< lines), or pass \ |
| 2076 | --allow-conflict-markers to override. No commit was created.", |
| 2077 | path, line |
no test coverage detected