mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 20:43:21 +00:00
Update hook to not add unstaged files
This commit is contained in:
parent
e823db0698
commit
279ff4927a
1 changed files with 3 additions and 1 deletions
|
@ -136,7 +136,9 @@ pub fn install_format_hook() -> Result<()> {
|
|||
r#"#!/bin/sh
|
||||
|
||||
cargo format
|
||||
git update-index --add ."#
|
||||
for path in $( git diff --name-only --cached ); do
|
||||
git update-index --add $path
|
||||
done"#
|
||||
)?;
|
||||
} else {
|
||||
return Err(Error::new(ErrorKind::AlreadyExists, "Git hook already created").into());
|
||||
|
|
Loading…
Reference in a new issue