summaryrefslogtreecommitdiff
path: root/.config/git/git_template
diff options
context:
space:
mode:
Diffstat (limited to '.config/git/git_template')
-rwxr-xr-x.config/git/git_template/hooks/post-commit3
-rwxr-xr-x.config/git/git_template/hooks/post-receive12
2 files changed, 15 insertions, 0 deletions
diff --git a/.config/git/git_template/hooks/post-commit b/.config/git/git_template/hooks/post-commit
new file mode 100755
index 0000000..6d5dc58
--- /dev/null
+++ b/.config/git/git_template/hooks/post-commit
@@ -0,0 +1,3 @@
+#! /bin/bash
+
+git push origin main
diff --git a/.config/git/git_template/hooks/post-receive b/.config/git/git_template/hooks/post-receive
new file mode 100755
index 0000000..f40fac0
--- /dev/null
+++ b/.config/git/git_template/hooks/post-receive
@@ -0,0 +1,12 @@
+#! /bin/sh
+
+repo="$(pwd | rev | cut -d '/' -f1 | rev)"
+git --work-tree=/home/pico/git/"$repo" -git-dir=/home/pico/.local/git/"$repo" checkout -f
+
+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"