Skip to content

Commit 7414434

Browse files
cormacrelfipetkov
andauthored
Fix missing files in git deps due to ripgrep observing .ignore files (#932)
For example, https://github.com/rust-lang/cargo includes a .ignore file to ignore generated manpages in day-to-day searches. We need those manpages to build the crate. It's safe to use `rg -uuu` because it's a fresh checkout, there are no extra files that .gitignore should be hiding. --------- Co-authored-by: Ivan Petkov <[email protected]>
1 parent e7e7e8f commit 7414434

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1212
`dontStrip = true` builds, but can otherwise be controlled using
1313
`doRemapPathPrefix`.
1414

15+
### Fixed
16+
* `downloadCargoPackageFromGit` now correctly includes any files listed in a
17+
`.ignore` file (but otherwise not listed in `.gitignore`) when unpacking git
18+
checkouts.
19+
1520
## [0.21.2] - 2025-11-07
1621

1722
### Changed

lib/downloadCargoPackageFromGit.nix

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ stdenv.mkDerivation {
105105
(
106106
cd "$(dirname "$cargoToml")"
107107
108-
crateFiles="$(rg --follow --files --ignore-file=<(
108+
# NB: we tell ripgrep to ignore any ignore files (via -uuu) since we are manually
109+
# applying the includes/excludes defined in Cargo.toml. Since this is a fresh git
110+
# checkout, it will not include any files listed in .gitignore anyway!
111+
crateFiles="$(rg -uuu --follow --files --ignore-file=<(
109112
remarshal -i "$cargoToml" -if toml -of json \
110113
| jq -r '.package | if has("include") then .include | map("!\(.)" | sub("^!!"; "")) else .exclude // [] end| .[]?'
111114
echo '!/Cargo.toml'

0 commit comments

Comments
 (0)