frontpage-content/pre-commit.sh

16 lines
433 B
Bash
Raw Permalink Normal View History

2022-07-05 15:25:33 +02:00
#!/bin/bash
# echo '[ -s "$(pwd)/pre-commit.sh" ] && "$(pwd)/pre-commit.sh"' >> .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit
setdate() {
[[ ! "$1" =~ .*\.adoc$ ]] && return
# geändertes adoc
date=$(date -Iseconds)
sed -i "s/^:docdatetime:.*\$/:docdatetime: $date/" "$1"
git add "$1"
#echo "$1: $date"
}
git diff --cached --name-only | while read file; do setdate "$file"; done
#git add *.adoc