aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_tools/src/bin
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-10-17 17:36:55 +0100
committerAleksey Kladov <[email protected]>2019-10-17 20:54:38 +0100
commit7b15c4f7ae95e2e855cb783871906fa7bf364c4c (patch)
tree20a69aaf3ad803a4ca689ec143e9cc0a5049d5ca /crates/ra_tools/src/bin
parent65ab81e35868c09ac9c93cf1d53a607f5caede53 (diff)
WIP: move to xtasks
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}