From 2e374de893b66e4fadc7b52c5e6e2f4544a486e6 Mon Sep 17 00:00:00 2001 From: Danielle McLean Date: Fri, 14 Apr 2017 00:37:20 +1000 Subject: [PATCH] Improve speed of commit-msg hook by calculating git-guilt only once --- config/git/hooks/commit-msg | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/config/git/hooks/commit-msg b/config/git/hooks/commit-msg index 2e2f646..c673535 100755 --- a/config/git/hooks/commit-msg +++ b/config/git/hooks/commit-msg @@ -6,11 +6,8 @@ echo Calculating git guilt... >&2 # create a temporary commit for git-guilt to look at, using git-stash! git stash save -q -# stash@{0}^2 is the index. I know, it's weird. We call git-guilt twice because -# we want the nice colours when we commit in a terminal, but we don't want them -# in the actual commit message. -git guilt HEAD stash@{0}^2 >&2 -git guilt HEAD stash@{0}^2 >> $1 +# stash@{0}^2 is the index. I know, it's weird. +git guilt HEAD stash@{0}^2 | tee -a $1 >&2 # Now restore the changes from stash, so we can actually commit them. ;) git stash pop -q --index