mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +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
|
r#"#!/bin/sh
|
||||||
|
|
||||||
cargo format
|
cargo format
|
||||||
git update-index --add ."#
|
for path in $( git diff --name-only --cached ); do
|
||||||
|
git update-index --add $path
|
||||||
|
done"#
|
||||||
)?;
|
)?;
|
||||||
} else {
|
} else {
|
||||||
return Err(Error::new(ErrorKind::AlreadyExists, "Git hook already created").into());
|
return Err(Error::new(ErrorKind::AlreadyExists, "Git hook already created").into());
|
||||||
|
|
Loading…
Reference in a new issue