update git hook 'pre-commit'

main
Dominic Reich 11 months ago
parent 39cd6a2f5f
commit 454f048cab
Signed by: dominic
GPG Key ID: BC9D6AE1A3BE169A

@ -3,9 +3,8 @@
# Replace `last_modified_at` timestamp with current time # Replace `last_modified_at` timestamp with current time
# https://mademistakes.com/notes/adding-last-modified-timestamps-with-git/ # https://mademistakes.com/notes/adding-last-modified-timestamps-with-git/
git diff --cached --name-status | grep -E -i "^(A|M).*\.(md)$" | while read a b; do git diff --cached --name-status | egrep -i "^(A|M).*\.(md)$" | while read a b; do
cat $b | sed "/+++.*/,/+++.*/s/^lastmod.*$/lastmod = '$(date -u "+%Y-%m-%dT%H:%M:%S%z")'/" > tmp cat $b | sed "/---.*/,/---.*/s/^lastmod:.*$/lastmod: $(date -u "+%Y-%m-%dT%H:%M:%S%z")/" > tmp
mv tmp $b mv tmp $b
git add $b git add $b
done done

Loading…
Cancel
Save