aboutsummaryrefslogtreecommitdiffstats
path: root/roles/cgit/files/agefile-generator.sh
blob: b68a7a312f0a66b6748d02fb16b56d2de6e929dc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh
# https://git.zx2c4.com/cgit/tree/contrib/hooks/post-receive.agefile

set -xe

find "${1}" -name HEAD -type f -exec dirname {} \; | while read -r GIT_DIR
do
        export GIT_DIR
        agefile="$(git rev-parse --git-dir)"/info/web/last-modified

        mkdir -p "$(dirname "$agefile")"
        git for-each-ref \
                --sort=-authordate --count=1 \
                --format='%(authordate:iso8601)' \
                > "$agefile"
done
remember that computers suck.