aboutsummaryrefslogtreecommitdiff
path: root/xtask/src/bin
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-11-18 12:22:51 +0000
committerAleksey Kladov <[email protected]>2019-11-18 12:27:04 +0000
commit76da22e66aaccda4a428e41e233ef7f3732463fd (patch)
tree4448743e0fff2822c3f6bde607e4a97374441be3 /xtask/src/bin
parentb79d6789236bb53c5818949cc2960b5c4991cbeb (diff)
Don't create a separate bin for format hook
Diffstat (limited to 'xtask/src/bin')
-rw-r--r--xtask/src/bin/pre-commit.rs31
1 files changed, 0 insertions, 31 deletions
diff --git a/xtask/src/bin/pre-commit.rs b/xtask/src/bin/pre-commit.rs
deleted file mode 100644
index 44507fb74..000000000
--- a/xtask/src/bin/pre-commit.rs
+++ /dev/null
@@ -1,31 +0,0 @@
1//! FIXME: write short doc here
2
3use std::process::Command;
4
5use xtask::{codegen::Mode, project_root, run, run_rustfmt, Result};
6
7fn main() -> Result<()> {
8 run_rustfmt(Mode::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 anyhow::bail!(
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}