Skip to content

Commit e0f1490

Browse files
authored
fix: don't include .git in crates (#85)
See openai/codex#16590 We don't want to include the `.git` in the glob for the crate since this causes the compile action to be non-deterministic if the user is using a crate_git_repository
1 parent 9a7119e commit e0f1490

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

rs/private/crate_git_repository.bzl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ def _crate_git_repository_implementation(rctx):
110110

111111
rctx.file("BUILD.bazel", generate_build_file(rctx, cargo_toml, purl_qualifiers = {"vcs_url": vcs_url}))
112112

113+
# Since we're using `git` to download the repo, remove
114+
# the `.git` to make sure it's reproducible.
115+
rctx.delete(root.get_child(".git"))
113116
return rctx.repo_metadata(reproducible = True)
114117

115118
crate_git_repository = repository_rule(

rs/rust_crate.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def rust_crate(
4646
include = ["**"],
4747
exclude = [
4848
"**/* *",
49+
".git",
4950
".tmp_git_root/**/*",
5051
"BUILD",
5152
"BUILD.bazel",

0 commit comments

Comments
 (0)