-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add --allow-staged
to cargo fix
#5737
Comments
This should be a pretty isolated change in this function: Line 79 in 6a7672e
It will require some, but not very intimate, knowledge of the supported version control systems. You should add a few tests similar to ones found here. |
@alexcrichton I would like to help out with this issue. 👍 |
@JoshBrudnak: Ah. I should have replied earlier. I worked on this a bit on Saturday, and was going to reply saying I would be interested in working on it. Any chance I could try looking at this, and you could take #5740? I see you mentioned you were interested in both. |
@JoshBrudnak: Ah, ok. FWIW, my changes are in this branch: https://github.com/jljusten/cargo/commits/fix-allow-staged Maybe I'll re-work them as a follow-on to your change. |
Hey, this is now assigned to me to remind me to check in with you how this is going :) #5910 looks pretty good so far, @JoshBrudnak, and @jljusten's jljusten@2bbbca3 also contains a test -- would be great to combine the two! (For example: If you add each other to the forked repos as contributors, you can both push to each others PRs. Or you could cherry-pick the commits.) Both approaches are specific to git as far as I can see. Did you check if the other VCSs have something similar? We don't need to add support for that at first but it'd be great to know what we might also want to do. |
I haven't checked other VCSs yet. @jljusten do you want me to cherry-pick jljusten/cargo@2bbbca3? |
@JoshBrudnak: If you cherry-pick just that patch, the test would fail. I changed the code to print out the list of staged files with |
In addition to
cargo fix --allow-dirty
, a user should also be able to pass--allow-staged
that lets them run cargo-fix even if there are no unstaged changes1.The rationale is that content that has been
git add
ed isn't actually in danger of being permanently eaten by a poor suggestion application, because you cangit checkout -- .
to back out the changes.Originally reported as rust-lang/rustfix#127
Footnotes
That's git terminology; it should behave similar similarly if Mercurial, Pijul, or Fossil have an analogue of Git's staging area—I'm not familiar ↩
The text was updated successfully, but these errors were encountered: