From 7b15c4f7ae95e2e855cb783871906fa7bf364c4c Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 17 Oct 2019 19:36:55 +0300 Subject: WIP: move to xtasks --- crates/ra_tools/src/bin/pre-commit.rs | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 crates/ra_tools/src/bin/pre-commit.rs (limited to 'crates/ra_tools/src/bin') 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 @@ -//! FIXME: write short doc here - -use std::process::Command; - -use ra_tools::{project_root, run, run_rustfmt, Overwrite, Result}; - -fn main() -> Result<()> { - run_rustfmt(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() { - Err(format!( - "`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