Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upImplement format hook #271
Conversation
DJMcNab
added some commits
Dec 9, 2018
matklad
reviewed
Dec 9, 2018
crates/tools/src/lib.rs
Outdated
| cargo format | ||
| for path in $( git diff --name-only --cached ); do | ||
| git update-index --add $path | ||
| done"# |
This comment has been minimized.
This comment has been minimized.
matklad
Dec 9, 2018
Collaborator
Hm, let's make a hook itself a rust program, so that it doesn't depend on a particular shell and works on windows?
What I have in mind is to have a src/bin/pre-commit.rs program which basically runs this function.
Then the install-format-hook would run cargo build --release --package tools --bin pre-commit and copy the binary from target/release to ./git/hooks
This comment has been minimized.
This comment has been minimized.
|
bors r+ |
bot
added a commit
that referenced
this pull request
Dec 9, 2018
This comment has been minimized.
This comment has been minimized.
Build succeeded |
bors
bot
merged commit cbce28a
into
rust-analyzer:master
Dec 9, 2018
DJMcNab
deleted the
DJMcNab:feat/format_hook
branch
Dec 19, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
DJMcNab commentedDec 9, 2018
Tentatively: fixes #155.
However, this does add all changes in staged files, which might not be desirable. However, I think we can't solve that without explicit support in rustfmt for it, so it should be fine.