diff options
author | DJMcNab <[email protected]> | 2018-12-09 10:37:04 +0000 |
---|---|---|
committer | DJMcNab <[email protected]> | 2018-12-09 10:37:04 +0000 |
commit | 279ff4927ade19c51553ea36147605c6ff4347ae (patch) | |
tree | 9ca66e58147b6b5049053088659659d74d4b5da0 /crates | |
parent | e823db06985d6782ff3803d3a4dea67a3c18426c (diff) |
Update hook to not add unstaged files
Diffstat (limited to 'crates')
-rw-r--r-- | crates/tools/src/lib.rs | 4 |
1 files changed, 3 insertions, 1 deletions
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<()> { | |||
136 | r#"#!/bin/sh | 136 | r#"#!/bin/sh |
137 | 137 | ||
138 | cargo format | 138 | cargo format |
139 | git update-index --add ."# | 139 | for path in $( git diff --name-only --cached ); do |
140 | git update-index --add $path | ||
141 | done"# | ||
140 | )?; | 142 | )?; |
141 | } else { | 143 | } else { |
142 | return Err(Error::new(ErrorKind::AlreadyExists, "Git hook already created").into()); | 144 | return Err(Error::new(ErrorKind::AlreadyExists, "Git hook already created").into()); |