aboutsummaryrefslogtreecommitdiff
path: root/crates/tools/src/bin
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-06-10 23:47:37 +0100
committerAleksey Kladov <[email protected]>2019-06-10 23:47:37 +0100
commit10d34532e3e96ffd92c11e667deb453188c28282 (patch)
tree095ad479dde329bdbff034af1f3ec587f473b1db /crates/tools/src/bin
parent75e6c03883c4533b1134c806d166b72200b4837d (diff)
rename tools -> ra_tools
This should help with caching on CI I hope (see .travis.yml before_cache)
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}