Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd `--allow-staged` to `cargo fix` #5737
Comments
alexcrichton
added
the
C-feature-request
label
Jul 17, 2018
killercup
added
the
Command-fix
label
Jul 17, 2018
killercup
added this to the Edition RC 1 milestone
Aug 14, 2018
killercup
added
the
E-help-wanted
label
Aug 14, 2018
This comment has been minimized.
This comment has been minimized.
|
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. |
This comment has been minimized.
This comment has been minimized.
JoshBrudnak
commented
Aug 18, 2018
|
@alexcrichton I would like to help out with this issue. |
This comment has been minimized.
This comment has been minimized.
|
@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. |
This comment has been minimized.
This comment has been minimized.
JoshBrudnak
commented
Aug 21, 2018
aturon
assigned
killercup
Aug 21, 2018
This comment has been minimized.
This comment has been minimized.
|
@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. |
This comment has been minimized.
This comment has been minimized.
|
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. |
This comment has been minimized.
This comment has been minimized.
JoshBrudnak
commented
Aug 21, 2018
|
I haven't checked other VCSs yet. @jljusten do you want me to cherry-pick jljusten/cargo@2bbbca3? |
This comment has been minimized.
This comment has been minimized.
|
@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 |
alexcrichton commentedJul 17, 2018
•
edited by killercup
In addition to
cargo fix --allow-dirty, a user should also be able to pass--allow-stagedthat lets them run cargo-fix even if there are no unstaged changes[^1].The rationale is that content that has been
git added isn't actually in danger of being permanently eaten by a poor suggestion application, because you cangit checkout -- .to back out the changes.[^1]: 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
Originally reported as rust-lang-nursery/rustfix#127