aboutsummaryrefslogtreecommitdiff
path: root/crates/tools/src/bin
diff options
context:
space:
mode:
Diffstat (limited to 'crates/tools/src/bin')
-rw-r--r--crates/tools/src/bin/pre-commit.rs28
1 files changed, 0 insertions, 28 deletions
diff --git a/crates/tools/src/bin/pre-commit.rs b/crates/tools/src/bin/pre-commit.rs
deleted file mode 100644
index ea18c0863..000000000
--- a/crates/tools/src/bin/pre-commit.rs
+++ /dev/null
@@ -1,28 +0,0 @@
1use std::process::Command;
2
3use failure::bail;
4
5use tools::{Result, run_rustfmt, run, project_root};
6
7fn main() -> tools::Result<()> {
8 run_rustfmt(tools::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 bail!("`git diff --diff-filter=MAR --name-only --cached` exited with {}", output.status);
23 }
24 for line in String::from_utf8(output.stdout)?.lines() {
25 run(&format!("git update-index --add {}", root.join(line).to_string_lossy()), ".")?;
26 }
27 Ok(())
28}