Skip to content

Commit cb13448

Browse files
committed
Fix rollback dropping hidden cache records
Pass shadowed_registry: true to cargo_copies_still_patched in rollback to detect patched copies in the shared /usr/local/cargo/registry/src even when shadowed by a vendor directory. This prevents dropping manifest records for still-patched cache copies, matching scan prune's behavior. Fixes bug where rollback with vendor/ present would skip cache-patched crates, succeed on vendored copies, then drop the manifest record, orphaning the patched cache copy with no way to restore it.
1 parent fb9fb3a commit cb13448

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

  • crates
    • socket-patch-cli/src/commands
    • socket-patch-core/src/patch/redirect/upstream

‎crates/socket-patch-cli/src/commands/rollback.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2040,7 +2040,7 @@ pub(crate) async fn rollback_patches_inner(
20402040
&vendored_purls,
20412041
&common.crawler_options(),
20422042
&blobs_path,
2043-
false,
2043+
true,
20442044
)
20452045
.await;
20462046
let (cache_targets, vendored_targets): (Vec<_>, Vec<_>) = vendored_targets

‎crates/socket-patch-core/src/patch/redirect/upstream/mod.rs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,10 @@ mod tests {
917917
fn bun_lock_remedies_name_the_forced_reinstall() {
918918
for file in ["bun.lockb", "bun.lock", "packages/app/bun.lockb"] {
919919
let remedy = checkout_remedy(&[file.to_string()]);
920-
assert!(remedy.contains(&format!("`git checkout -- {file}`")), "{remedy}");
920+
assert!(
921+
remedy.contains(&format!("`git checkout -- {file}`")),
922+
"{remedy}"
923+
);
921924
assert!(remedy.ends_with(
922925
", then run `bun install --force` (a plain `bun install` keeps the patched copy)"
923926
), "{remedy}");

0 commit comments

Comments
 (0)