From 279ff4927ade19c51553ea36147605c6ff4347ae Mon Sep 17 00:00:00 2001 From: DJMcNab <36049421+DJMcNab@users.noreply.github.com> Date: Sun, 9 Dec 2018 10:37:04 +0000 Subject: Update hook to not add unstaged files --- crates/tools/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/tools/src/lib.rs b/crates/tools/src/lib.rs index d6c448f3b..bc550c597 100644 --- a/crates/tools/src/lib.rs +++ b/crates/tools/src/lib.rs @@ -136,7 +136,9 @@ pub fn install_format_hook() -> Result<()> { r#"#!/bin/sh cargo format -git update-index --add ."# +for path in $( git diff --name-only --cached ); do + git update-index --add $path +done"# )?; } else { return Err(Error::new(ErrorKind::AlreadyExists, "Git hook already created").into()); -- cgit v1.2.3