git/dot-config/git/hooks/commit-msg
2023-10-23 15:15:06 +11:00

18 lines
531 B
Bash
Executable file

#!/bin/sh
echo >> $1
echo Calculating git guilt... >&2
# git-guilt only works on actual commits, not on the index. Fortunately we can
# 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.
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
echo >> $1
echo Fetching a whatthecommit message... >&2
curl -s http://whatthecommit.com/index.txt | tee -a $1 >&2