1
Fork 0
userscripts/.githooks/pre-commit

9 lines
340 B
Bash
Executable file

#!/bin/sh
staged="$(git diff --cached --diff-filter=d --name-only -- scripts)"
[ "$staged" ] || exit 0
git diff --name-only -- scripts | grep --fixed-strings "$staged" && exit 1
version="$(date --utc +%Y.%m.%d.%H%M%S)"
echo "$staged" | while read -r file; do
sed --in-place "s/@version .*/@version $version/" "$file"
git add "$file"
done