aboutsummaryrefslogtreecommitdiff
path: root/hooks/post-commit
diff options
context:
space:
mode:
authorTom Harley2020-12-31 08:32:31 +0000
committerTom Harley2020-12-31 08:33:29 +0000
commitc681ac32efee885452164a4430360b327a86e5a2 (patch)
tree7c0110290e94d1e43c58e058f49e2221c7ff468f /hooks/post-commit
parentAdd terminal-title-setting code (diff)
downloadhome-manager-generation-157.tar.gz
home-manager-generation-157.zip

Add generation auto-tagging with post-commit hook

generation-157
Diffstat (limited to 'hooks/post-commit')
-rwxr-xr-xhooks/post-commit9
1 files changed, 9 insertions, 0 deletions
diff --git a/hooks/post-commit b/hooks/post-commit
new file mode 100755
index 0000000..d9831b5
--- /dev/null
+++ b/hooks/post-commit
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+generation_id=$(home-manager generations | awk -e 'NR==1 { print $5 }')
+generation_tag="generation-$generation_id"
+
+if ! git rev-parse "$generation_tag" > /dev/null 2>&1; then
+ echo "tagging $generation_tag"
+ git tag "$generation_tag"
+fi