rust-lang/rustfix

Dirty detection doesn't take .gitignore into account

carols10cents opened this issue · 2 comments

What happened

I'm using:

  • rustc 1.29.0-nightly (6a1c0637c 2018-07-23)
  • cargo-fix v0.4.1

I'm trying out rustfix on crates.io. My working directory is clean according to git; no files are listed when I run git status. When I run cargo fix --prepare-for 2018, I get:

error: the working directory of this project is detected as dirty, and `cargo fix` can potentially perform destructive changes; if you'd like to suppress this error pass `--allow-dirty`, or commit the changes to these files:

  * .DS_Store
  * .env
  * dist/
  * local_uploads/
  * node_modules/
  * public/.DS_Store
  * target/
  * tmp/

crates.io's .gitignore is:

/target
.cargo

# compiled output
/dist
/tmp

# dependencies
/node_modules
/bower_components

# misc
/.sass-cache
/connect.lock
/coverage/*
/coverage_*
/local_uploads
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
.env
docker-compose.override.yml

And in my ~/.gitignore_global, I have:

.DS_Store

What I expected to happen

I expected rustfix to ignore the same files that are ignored by git for the purposes of dirty detection, and run without needing the --allow-dirty flag if git status doesn't list any files.

@carols10cents I believe this was just fixed by rust-lang/cargo#5770 -- you might need to build cargo yourself right now to test it, though

Ooops. I checked here for existing issues but didn't check in cargo's :( I'll close this and reopen if it isn't fixed in the next nightly.