From 7bfe2ddbf1feeeb77e5fdb2771a4ae81457a37d6 Mon Sep 17 00:00:00 2001 From: Brian Zalewski Date: Wed, 25 Jan 2023 01:14:55 +0000 Subject: [PATCH] Update 9 files - /home/dot_config/git/template/hooks/symlink_commit-msg.tmpl - /home/dot_config/git/template/hooks/symlink_post-checkout.tmpl - /home/dot_config/git/template/hooks/symlink_post-commit.tmpl - /home/dot_config/git/template/hooks/symlink_post-merge.tmpl - /home/dot_config/git/template/hooks/symlink_post-rewrite.tmpl - /home/dot_config/git/template/hooks/symlink_pre-commit.tmpl - /home/dot_config/git/template/hooks/symlink_pre-push.tmpl - /home/dot_config/git/template/hooks/symlink_prepare-commit-msg.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_08-git-hooks.tmpl --- .../universal/run_onchange_after_08-git-hooks.tmpl | 14 ++++++++++++-- .../git/template/hooks/symlink_commit-msg.tmpl | 3 --- .../git/template/hooks/symlink_post-checkout.tmpl | 3 --- .../git/template/hooks/symlink_post-commit.tmpl | 3 --- .../git/template/hooks/symlink_post-merge.tmpl | 3 --- .../git/template/hooks/symlink_post-rewrite.tmpl | 3 --- .../git/template/hooks/symlink_pre-commit.tmpl | 3 --- .../git/template/hooks/symlink_pre-push.tmpl | 3 --- .../template/hooks/symlink_prepare-commit-msg.tmpl | 3 --- 9 files changed, 12 insertions(+), 26 deletions(-) delete mode 100644 home/dot_config/git/template/hooks/symlink_commit-msg.tmpl delete mode 100644 home/dot_config/git/template/hooks/symlink_post-checkout.tmpl delete mode 100644 home/dot_config/git/template/hooks/symlink_post-commit.tmpl delete mode 100644 home/dot_config/git/template/hooks/symlink_post-merge.tmpl delete mode 100644 home/dot_config/git/template/hooks/symlink_post-rewrite.tmpl delete mode 100644 home/dot_config/git/template/hooks/symlink_pre-commit.tmpl delete mode 100644 home/dot_config/git/template/hooks/symlink_pre-push.tmpl delete mode 100644 home/dot_config/git/template/hooks/symlink_prepare-commit-msg.tmpl diff --git a/home/.chezmoiscripts/universal/run_onchange_after_08-git-hooks.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_08-git-hooks.tmpl index e72f26b2..6b13d7ac 100644 --- a/home/.chezmoiscripts/universal/run_onchange_after_08-git-hooks.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_after_08-git-hooks.tmpl @@ -11,10 +11,20 @@ {{- end -}} {{- end }} +### Ensure git hooks directory exists +logg info 'Ensuring git hooks directory exists' +mkdir -p "${XDG_CONFIG_HOME:-$HOME/.config}/git/template/hooks" + ### Ensure git hooks are executable -logg info 'Ensuring git hooks are executable' +logg info 'Ensuring git hooks are up-to-date' find "$HOME/.local/src/shared-common/common/.config/husky" -mindepth 1 -maxdepth 1 -type f | while read HOOK; do - chmod +x "$HOOK" + cp "$HOOK" "${XDG_CONFIG_HOME:-$HOME/.config}/git/template/hooks" done +### Make git hooks executable +if [ -d "${XDG_CONFIG_HOME:-$HOME/.config}/git/template/hooks" ]; then + logg info 'Ensuring git hooks are executable' + chmod +x "${XDG_CONFIG_HOME:-$HOME/.config}/git/template/hooks/*" +fi + {{ end -}} diff --git a/home/dot_config/git/template/hooks/symlink_commit-msg.tmpl b/home/dot_config/git/template/hooks/symlink_commit-msg.tmpl deleted file mode 100644 index b63e98d7..00000000 --- a/home/dot_config/git/template/hooks/symlink_commit-msg.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -{{- if true -}} -{{ .host.home }}/.local/src/shared-common/common/.config/husky/commit-msg -{{- end -}} diff --git a/home/dot_config/git/template/hooks/symlink_post-checkout.tmpl b/home/dot_config/git/template/hooks/symlink_post-checkout.tmpl deleted file mode 100644 index 0a0ccf59..00000000 --- a/home/dot_config/git/template/hooks/symlink_post-checkout.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -{{- if true -}} -{{ .host.home }}/.local/src/shared-common/common/.config/husky/post-checkout -{{- end -}} diff --git a/home/dot_config/git/template/hooks/symlink_post-commit.tmpl b/home/dot_config/git/template/hooks/symlink_post-commit.tmpl deleted file mode 100644 index 33f2836f..00000000 --- a/home/dot_config/git/template/hooks/symlink_post-commit.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -{{- if true -}} -{{ .host.home }}/.local/src/shared-common/common/.config/husky/post-commit -{{- end -}} diff --git a/home/dot_config/git/template/hooks/symlink_post-merge.tmpl b/home/dot_config/git/template/hooks/symlink_post-merge.tmpl deleted file mode 100644 index d1640e10..00000000 --- a/home/dot_config/git/template/hooks/symlink_post-merge.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -{{- if true -}} -{{ .host.home }}/.local/src/shared-common/common/.config/husky/post-merge -{{- end -}} diff --git a/home/dot_config/git/template/hooks/symlink_post-rewrite.tmpl b/home/dot_config/git/template/hooks/symlink_post-rewrite.tmpl deleted file mode 100644 index 1f6308f8..00000000 --- a/home/dot_config/git/template/hooks/symlink_post-rewrite.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -{{- if true -}} -{{ .host.home }}/.local/src/shared-common/common/.config/husky/post-rewrite -{{- end -}} diff --git a/home/dot_config/git/template/hooks/symlink_pre-commit.tmpl b/home/dot_config/git/template/hooks/symlink_pre-commit.tmpl deleted file mode 100644 index 20d6eab9..00000000 --- a/home/dot_config/git/template/hooks/symlink_pre-commit.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -{{- if true -}} -{{ .host.home }}/.local/src/shared-common/common/.config/husky/pre-commit -{{- end -}} diff --git a/home/dot_config/git/template/hooks/symlink_pre-push.tmpl b/home/dot_config/git/template/hooks/symlink_pre-push.tmpl deleted file mode 100644 index 2edb565e..00000000 --- a/home/dot_config/git/template/hooks/symlink_pre-push.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -{{- if true -}} -{{ .host.home }}/.local/src/shared-common/common/.config/husky/pre-push -{{- end -}} diff --git a/home/dot_config/git/template/hooks/symlink_prepare-commit-msg.tmpl b/home/dot_config/git/template/hooks/symlink_prepare-commit-msg.tmpl deleted file mode 100644 index 1acc9b92..00000000 --- a/home/dot_config/git/template/hooks/symlink_prepare-commit-msg.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -{{- if true -}} -{{ .host.home }}/.local/src/shared-common/common/.config/husky/prepare-commit-msg -{{- end -}}