From 76da22e66aaccda4a428e41e233ef7f3732463fd Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 18 Nov 2019 15:22:51 +0300 Subject: Don't create a separate bin for format hook --- xtask/src/bin/pre-commit.rs | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 xtask/src/bin/pre-commit.rs (limited to 'xtask/src/bin') 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 @@ -//! FIXME: write short doc here - -use std::process::Command; - -use xtask::{codegen::Mode, project_root, run, run_rustfmt, Result}; - -fn main() -> Result<()> { - run_rustfmt(Mode::Overwrite)?; - update_staged() -} - -fn update_staged() -> Result<()> { - let root = project_root(); - let output = Command::new("git") - .arg("diff") - .arg("--diff-filter=MAR") - .arg("--name-only") - .arg("--cached") - .current_dir(&root) - .output()?; - if !output.status.success() { - anyhow::bail!( - "`git diff --diff-filter=MAR --name-only --cached` exited with {}", - output.status - ); - } - for line in String::from_utf8(output.stdout)?.lines() { - run(&format!("git update-index --add {}", root.join(line).to_string_lossy()), ".")?; - } - Ok(()) -} -- cgit v1.2.3