summaryrefslogtreecommitdiff
path: root/hooks
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2022-12-03 21:48:53 -0700
committerSean Whitton <spwhitton@spwhitton.name>2022-12-04 10:24:24 -0700
commite4968b90370100b6b7d4afca563568f06b6c5f2e (patch)
treef4f62738574bac308a80085a8d16a50da2f7c617 /hooks
parent1017e90e4b117df5871fe6447fb6587a5bd98cb5 (diff)
downloaddotfiles-e4968b90370100b6b7d4afca563568f06b6c5f2e.tar.gz
move most repository git config into included files & some tidying
Diffstat (limited to 'hooks')
-rwxr-xr-xhooks/git/dotfiles/pre-commit_01generate17
1 files changed, 17 insertions, 0 deletions
diff --git a/hooks/git/dotfiles/pre-commit_01generate b/hooks/git/dotfiles/pre-commit_01generate
new file mode 100755
index 00000000..47a1e540
--- /dev/null
+++ b/hooks/git/dotfiles/pre-commit_01generate
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# by Sean Whitton, 2022, GPL-3+
+
+set -e
+IFS="$(printf '\n\t')"
+cd ~/src/dotfiles/lib-src/git
+[ -e includes ] && git diff --quiet --cached --diff-filter=AD -- . && exit
+rm -f includes
+for f in $(find . ! -name . ! -type d \
+ ! -name "$(printf '*[\001-\037\177]*')" \
+ | cut -c2- | LC_ALL=C sort); do
+ printf \
+ '[includeIf "gitdir:~%s/"]\n\tpath = ~/src/dotfiles/lib-src/git%s\n' \
+ "$f" "$f" >>includes
+done
+git add includes