Skip to content

Commit

Permalink
Ensure that builds within the cache aren't considered Git repositories
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Feb 20, 2024
1 parent 8df48f0 commit db1f84e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions crates/uv-cache/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,15 @@ impl Cache {
file.write_all(b"*")?;
}

// Add a phony .git, if it doesn't exist, to ensure that the cache isn't considered to be
// part of a Git repository. (Some packages will include Git metadata (like a hash) in the
// built version if they're in a Git repository, but the cache should be viewed as an
// isolated store.)
let git_path = root.join(".git");
if !git_path.exists() {
fs::File::create(git_path)?;
}

fs::canonicalize(root)
}

Expand Down

0 comments on commit db1f84e

Please sign in to comment.