Using git for change detection causes issue when moving/renaming files
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 15.5k
- Forks
- 3k
- Avg merge
- 23h 30m
- Merged PRs (30d)
- 51
Description
Problem
Whilst working in a workspace, I copied a Rust package to another folder. Upon running cargo build, it would do nothing, with no error, but 100% CPU usage.
When using RUST_LOG=trace CARGO_LOG=trace cargo build I saw many failed to get mtime of... messages.
Only until I made a VCS commit, did things start working again.
Unfortunately I did not record the logs before the fix so I will have to try and repro it again.
I did notice a line like this though:
[2021-10-20T13:36:50Z WARN cargo::sources::path] list_files_git my-package v0.1.0 (/xxx/my-package)
Which made me think it was git related.
So something to do with list_files_git and fingerprinting causes issues. I think relying on git for any kind of change detection will cause issues.
I will look to do a repro when I have time.
Steps
No response
Possible Solution(s)
Workaround is to commit your files. Or specify include should disable this functionality.
Notes
No response
Version
cargo version --verbose
cargo 1.54.0 (5ae8d74b3 2021-06-22)
release: 1.54.0
commit-hash: 5ae8d74b3b2d58f32c8d357e5cfa04d430a70e0b
commit-date: 2021-06-22
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/cargo/sources/path.rs, especially list_files_git and the linked fingerprinting-related lines. Reproduce the issue by copying a Rust package and moving or renaming files, then run cargo build with tracing enabled. Done means the build completes without hanging, excessive CPU use, or failed mtime messages without requiring a VCS commit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100