A deterministic multi-package lockfile. `packages` drives both the line count and the byte count. `bump_from` rewrites the versions of every package at or after that index, so the follow-up commit produces IN-PLACE replace hunks scattered mid-file — the shape that corrupted the staged render (the real Cargo.lock diff replaced lines ~1210-1220 across 14 hunks while the graph held the file as one wh
(packages: usize, bump_from: usize)
| 72 | /// staged render (the real Cargo.lock diff replaced lines ~1210-1220 across |
| 73 | /// 14 hunks while the graph held the file as one whole-content vertex). |
| 74 | fn lockfile(packages: usize, bump_from: usize) -> Vec<u8> { |
| 75 | let mut content = String::from("# This file is automatically @generated by Cargo.\n"); |
| 76 | content.push_str("version = 3\n\n"); |
| 77 | for package in 0..packages { |
| 78 | let major = if package >= bump_from { 2 } else { 1 }; |
| 79 | content.push_str(&format!( |
| 80 | "[[package]]\nname = \"dep-{package}\"\nversion = \"{major}.{}.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"aaaaaaaa{package:04}bbbbbbbb{package:04}cccccccc{package:04}dddddddd{package:04}\"\ndependencies = [\n \"dep-{}\",\n]\n\n", |
| 81 | package % 10, |
| 82 | package.saturating_sub(1) |
| 83 | )); |
| 84 | } |
| 85 | content.into_bytes() |
| 86 | } |
| 87 | |
| 88 | #[test] |
| 89 | fn git_import_records_a_modified_generated_file_with_exact_content() { |
no outgoing calls
no test coverage detected