diff options
Diffstat (limited to 'crates/ra_tools/src/bin')
-rw-r--r-- | crates/ra_tools/src/bin/pre-commit.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/crates/ra_tools/src/bin/pre-commit.rs b/crates/ra_tools/src/bin/pre-commit.rs index c514e992b..95bb55cae 100644 --- a/crates/ra_tools/src/bin/pre-commit.rs +++ b/crates/ra_tools/src/bin/pre-commit.rs | |||
@@ -1,7 +1,5 @@ | |||
1 | use std::process::Command; | 1 | use std::process::Command; |
2 | 2 | ||
3 | use failure::bail; | ||
4 | |||
5 | use ra_tools::{Result, run_rustfmt, run, project_root, Overwrite}; | 3 | use ra_tools::{Result, run_rustfmt, run, project_root, Overwrite}; |
6 | 4 | ||
7 | fn main() -> Result<()> { | 5 | fn main() -> Result<()> { |
@@ -19,7 +17,10 @@ fn update_staged() -> Result<()> { | |||
19 | .current_dir(&root) | 17 | .current_dir(&root) |
20 | .output()?; | 18 | .output()?; |
21 | if !output.status.success() { | 19 | if !output.status.success() { |
22 | bail!("`git diff --diff-filter=MAR --name-only --cached` exited with {}", output.status); | 20 | Err(format!( |
21 | "`git diff --diff-filter=MAR --name-only --cached` exited with {}", | ||
22 | output.status | ||
23 | ))?; | ||
23 | } | 24 | } |
24 | for line in String::from_utf8(output.stdout)?.lines() { | 25 | for line in String::from_utf8(output.stdout)?.lines() { |
25 | run(&format!("git update-index --add {}", root.join(line).to_string_lossy()), ".")?; | 26 | run(&format!("git update-index --add {}", root.join(line).to_string_lossy()), ".")?; |