Ensure we don't overwrite an existing Cargo.lock when fetching an external git repo

This commit is contained in:
bjorn3 2023-10-14 12:41:44 +00:00
parent f06831441b
commit 62bf33a9c6

View File

@ -143,6 +143,7 @@ pub(crate) fn fetch(&self, dirs: &Dirs) {
RelPath::PATCHES.to_path(dirs).join(format!("{}-lock.toml", self.patch_name));
let target_lockfile = download_dir.join("Cargo.lock");
if source_lockfile.exists() {
assert!(!target_lockfile.exists());
fs::copy(source_lockfile, target_lockfile).unwrap();
} else {
assert!(target_lockfile.exists());