From 3eb16d93bf95b2a7d40fb1607622cab1e2f4b81e Mon Sep 17 00:00:00 2001 From: Parabola git Date: Fri, 8 Jul 2016 00:55:19 +0000 Subject: redo hooks infrastructure (yay git 2.9 core.hooksPath) --- .config/git/config | 5 +++++ .config/git/hooks/post-receive | 1 + .config/git/hooks/post-receive.d/agefile | 9 +++++++++ .config/git/hooks/post-update | 1 + .config/git/hooks/pre-receive | 1 + .config/git/hooks/run-parts.sh | 9 +++++++++ .config/git/hooks/update | 1 + .config/git/ignore | 13 +++++++++++++ 8 files changed, 40 insertions(+) create mode 100644 .config/git/config create mode 120000 .config/git/hooks/post-receive create mode 100755 .config/git/hooks/post-receive.d/agefile create mode 120000 .config/git/hooks/post-update create mode 120000 .config/git/hooks/pre-receive create mode 100755 .config/git/hooks/run-parts.sh create mode 120000 .config/git/hooks/update create mode 100644 .config/git/ignore (limited to '.config') diff --git a/.config/git/config b/.config/git/config new file mode 100644 index 0000000..2144347 --- /dev/null +++ b/.config/git/config @@ -0,0 +1,5 @@ +[user] + name = Parabola git + email = git@parabola.nu +[core] + hooksPath = /srv/git/.config/git/hooks diff --git a/.config/git/hooks/post-receive b/.config/git/hooks/post-receive new file mode 120000 index 0000000..081071a --- /dev/null +++ b/.config/git/hooks/post-receive @@ -0,0 +1 @@ +run-parts.sh \ No newline at end of file diff --git a/.config/git/hooks/post-receive.d/agefile b/.config/git/hooks/post-receive.d/agefile new file mode 100755 index 0000000..10fc253 --- /dev/null +++ b/.config/git/hooks/post-receive.d/agefile @@ -0,0 +1,9 @@ +#!/bin/bash +set -x +agefile="$(git rev-parse --git-dir)"/info/web/last-modified + +mkdir -p "$(dirname "$agefile")" && +git for-each-ref \ + --sort=-committerdate --count=1 \ + --format='%(committerdate:iso8601)' \ + > "$agefile" diff --git a/.config/git/hooks/post-update b/.config/git/hooks/post-update new file mode 120000 index 0000000..081071a --- /dev/null +++ b/.config/git/hooks/post-update @@ -0,0 +1 @@ +run-parts.sh \ No newline at end of file diff --git a/.config/git/hooks/pre-receive b/.config/git/hooks/pre-receive new file mode 120000 index 0000000..081071a --- /dev/null +++ b/.config/git/hooks/pre-receive @@ -0,0 +1 @@ +run-parts.sh \ No newline at end of file diff --git a/.config/git/hooks/run-parts.sh b/.config/git/hooks/run-parts.sh new file mode 100755 index 0000000..c42173a --- /dev/null +++ b/.config/git/hooks/run-parts.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +if [[ -d "$0.d" ]]; then + run-parts "${@/#/--arg=}" -- "$0.d" +fi +file="$GIT_DIR/hooks/${0##*/}" +if [[ -x "$file" && -f "$file" ]]; then + "$file" +fi diff --git a/.config/git/hooks/update b/.config/git/hooks/update new file mode 120000 index 0000000..081071a --- /dev/null +++ b/.config/git/hooks/update @@ -0,0 +1 @@ +run-parts.sh \ No newline at end of file diff --git a/.config/git/ignore b/.config/git/ignore new file mode 100644 index 0000000..006a323 --- /dev/null +++ b/.config/git/ignore @@ -0,0 +1,13 @@ +# Things in /srv/git directly to ignore +/.??* +!/.config/ + +# General files to ignore +*~ +*.sample + +# Ignore most of the things in git repos +**/*.git/* +!**/*.git/config +!**/*.git/description +!**/*.git/hooks/ -- cgit v1.2.3