lean4-htt/script/prepare-commit-msg
2018-06-07 16:55:36 +02:00

13 lines
280 B
Bash
Executable file

#!/bin/bash
set -eo pipefail
# exit on existing commit message
[[ -z "$2" ]] || exit 0
diff=$(git diff --staged --stat | head -n -1)
[[ $(echo "$diff" | wc -l) == 1 ]] || exit 0
file=$(echo "$diff" | cut -f 2 -d' ')
orig=$(cat "$1")
echo "feat($file):" > $1
echo "$orig" >> $1