diff options
author | Romain Gonçalves <me@rgoncalves.se> | 2024-05-12 22:13:47 +0200 |
---|---|---|
committer | Romain Gonçalves <me@rgoncalves.se> | 2024-05-12 22:13:47 +0200 |
commit | 7ac69b748b2958f586e0200fa035adc032447ad5 (patch) | |
tree | 615fc5df9d028b498b5660706a229ed82e5e406c /roles/cgit/files/agefile-generator.sh | |
parent | 5b2776c62a839bad57ef2f00a8e450ed6543ca16 (diff) | |
download | rules-7ac69b748b2958f586e0200fa035adc032447ad5.tar.gz |
feat(roles/cgit): periodically generate age file
Diffstat (limited to 'roles/cgit/files/agefile-generator.sh')
-rw-r--r-- | roles/cgit/files/agefile-generator.sh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/roles/cgit/files/agefile-generator.sh b/roles/cgit/files/agefile-generator.sh new file mode 100644 index 0000000..b68a7a3 --- /dev/null +++ b/roles/cgit/files/agefile-generator.sh @@ -0,0 +1,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 |