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.rs31
1 files changed, 0 insertions, 31 deletions
diff --git a/crates/ra_tools/src/bin/pre-commit.rs b/crates/ra_tools/src/bin/pre-commit.rs
deleted file mode 100644
index 16bbf9cb2..000000000
--- a/crates/ra_tools/src/bin/pre-commit.rs
+++ /dev/null
@@ -1,31 +0,0 @@
1//! FIXME: write short doc here
2
3use std::process::Command;
4
5use ra_tools::{project_root, run, run_rustfmt, Overwrite, Result};
6
7fn main() -> Result<()> {
8 run_rustfmt(Overwrite)?;
9 update_staged()
10}
11
12fn update_staged() -> Result<()> {
13 let root = project_root();
14 let output = Command::new("git")
15 .arg("diff")
16 .arg("--diff-filter=MAR")
17 .arg("--name-only")
18 .arg("--cached")
19 .current_dir(&root)
20 .output()?;
21 if !output.status.success() {
22 Err(format!(
23 "`git diff --diff-filter=MAR --name-only --cached` exited with {}",
24 output.status
25 ))?;
26 }
27 for line in String::from_utf8(output.stdout)?.lines() {
28 run(&format!("git update-index --add {}", root.join(line).to_string_lossy()), ".")?;
29 }
30 Ok(())
31}