ITADN

Incorrect include/exclude behavior with git dependencies (doesn't match `cargo package`)

#962Closedvikanezrimaya 创建于 2026-01-26
bug
V
vikanezrimayacommented
**Describe the bug** <!-- Please describe the error and provide error logs as appropriate. If something is confusing or unclear, please describe what you would have expected to happen Otherwise, if you need help debugging a broken build configuration, consider opening a discussion: https://github.com/ipetkov/crane/discussions --> Package with a git dependency that has a really complicated `include` section in Cargo.toml doesn't build, because `ripgrep` excludes files that `cargo package` would leave included. (There are two conflicting rules, which Cargo and ripgrep seem to interpret differently; cargo allows the more specific include rule to take precedence over the more vague exclusion rule, while ripgrep excludes it based on the vague wildcard rule). **Reproduction** <!-- Please provide a(n ideally minimal,) fully self-contained flake that reproduces the issue, and specify which output needs to be built that shows the error. A partial snippet is not enough to fully investigate potential issues. --> ```console $ nix build -L github:vikanezrimaya/crane-git-dep-include-bug ``` **Additional notes** Adding `--debug` to the `rg` invocation in `lib/downloadCargoPackageFromGit.nix` confirmed the specific `rg` interpretation described above, while running `cargo package` in the git checkout of the aforementioned dependency and inspecting the `.crate` files confirmed that Cargo's behavior matches my expectations. Perhaps it would be better to simply run `cargo package` in the crate checkout and then unpack the crates into `$out` instead of emulating Cargo's behavior using ripgrep?
关闭于 2026-02-15 4 条评论