Skip to content

Commit

Permalink
fix: don't overwrite unexpanded git-lfs pointer files. (#607)
Browse files Browse the repository at this point in the history
It's possible for those with incomplete `git-lfs` installations
(and many more situations) to end up in a spot where pointer files
aren't expanded. If we overwrite the with archives, files look
changed which can be confusing and lead to even bigger messes
to happen.

Now we don't overwrite those files anyomre.
  • Loading branch information
Byron committed Nov 21, 2022
1 parent 519db50 commit 495b2b5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/tools/src/lib.rs
Expand Up @@ -426,6 +426,13 @@ fn create_archive_if_not_on_ci(source_dir: &Path, archive: &Path, script_identit
if is_excluded(archive) {
return Ok(());
}
if std::fs::read(archive).map_or(false, |content| content.starts_with(b"version https://git-lfs")) {
eprintln!(
"Refusing to overwrite `git-lfs` pointer file at \"{}\" - git lfs might not be properly installed.",
archive.display()
);
return Ok(());
}
std::fs::create_dir_all(archive.parent().expect("archive is a file"))?;

let meta_dir = populate_meta_dir(source_dir, script_identity)?;
Expand Down

0 comments on commit 495b2b5

Please sign in to comment.