From: martin f. krafft Date: Thu, 1 May 2025 08:11:02 +0000 (+0200) Subject: hook to install pre-commit gitignore management hook X-Git-Url: https://git.madduck.net/etc/vcsh.git/commitdiff_plain/5fd7e0b86fb4937e3ad9d3754d76cce532cede64?ds=sidebyside hook to install pre-commit gitignore management hook --- diff --git a/.config/vcsh/hooks-available/install-gitignore-pre-commit-hook b/.config/vcsh/hooks-available/install-gitignore-pre-commit-hook new file mode 100755 index 0000000..5bfc972 --- /dev/null +++ b/.config/vcsh/hooks-available/install-gitignore-pre-commit-hook @@ -0,0 +1,13 @@ +#!/bin/sh + +HOOK=$GIT_DIR/hooks/pre-commit + +cat <<_eof >$HOOK +#!/bin/sh + +vcsh write-gitignore \$VCSH_REPO_NAME 2>/dev/null +git add -f ~/.gitignore.d/\$VCSH_REPO_NAME +rm -f ~/.gitignore.d/\${VCSH_REPO_NAME}.bak +_eof + +chmod 700 $HOOK diff --git a/.config/vcsh/hooks-enabled/post-clone.gitignore-hook b/.config/vcsh/hooks-enabled/post-clone.gitignore-hook new file mode 120000 index 0000000..387e84e --- /dev/null +++ b/.config/vcsh/hooks-enabled/post-clone.gitignore-hook @@ -0,0 +1 @@ +../hooks-available/install-gitignore-pre-commit-hook \ No newline at end of file diff --git a/.config/vcsh/hooks-enabled/post-init.gitignore-hook b/.config/vcsh/hooks-enabled/post-init.gitignore-hook new file mode 120000 index 0000000..387e84e --- /dev/null +++ b/.config/vcsh/hooks-enabled/post-init.gitignore-hook @@ -0,0 +1 @@ +../hooks-available/install-gitignore-pre-commit-hook \ No newline at end of file diff --git a/.gitignore.d/vcsh b/.gitignore.d/vcsh index 11f4cc9..6c53f09 100644 --- a/.gitignore.d/vcsh +++ b/.gitignore.d/vcsh @@ -1,5 +1,8 @@ * +!/.config/vcsh/hooks-available/install-gitignore-pre-commit-hook !/.config/vcsh/hooks-available/post-init.write-gitignore +!/.config/vcsh/hooks-enabled/post-clone.gitignore-hook +!/.config/vcsh/hooks-enabled/post-init.gitignore-hook !/.config/vcsh/hooks-enabled/post-init.write-gitignore !/.gitignore.d/.gitignore !/.gitignore.d/vcsh