aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_tools/src/bin
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_tools/src/bin')
-rw-r--r--crates/ra_tools/src/bin/pre-commit.rs7
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 @@
1use std::process::Command; 1use std::process::Command;
2 2
3use failure::bail;
4
5use ra_tools::{Result, run_rustfmt, run, project_root, Overwrite}; 3use ra_tools::{Result, run_rustfmt, run, project_root, Overwrite};
6 4
7fn main() -> Result<()> { 5fn 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()), ".")?;