(
repo: &atomic_repository::Repository,
git_sha: &str,
)
| 115 | } |
| 116 | |
| 117 | fn change_by_sha( |
| 118 | repo: &atomic_repository::Repository, |
| 119 | git_sha: &str, |
| 120 | ) -> atomic_core::change::Change { |
| 121 | // The importer records the Git SHA in the acceleration index; the |
| 122 | // authoritative lookup here walks the view history and matches the |
| 123 | // unhashed provenance, which is exactly what a foreign reader sees. |
| 124 | let entries = repo.effective_history(Some("main")).unwrap(); |
| 125 | let mut found = None; |
| 126 | for entry in entries { |
| 127 | let change = repo.load_change(&entry.hash).unwrap(); |
| 128 | let sha = change |
| 129 | .unhashed |
| 130 | .as_ref() |
| 131 | .and_then(|value| value.get("git")) |
| 132 | .and_then(|git| git.get("sha")) |
| 133 | .and_then(|sha| sha.as_str()); |
| 134 | if sha == Some(git_sha) { |
| 135 | found = Some(change); |
| 136 | break; |
| 137 | } |
| 138 | } |
| 139 | found.unwrap_or_else(|| panic!("no imported change for git commit {git_sha}")) |
| 140 | } |
| 141 | |
| 142 | #[test] |
| 143 | fn incremental_dry_run_leaves_legacy_database_untouched_until_explicit_open() { |
no test coverage detected