]> git.madduck.net Git - etc/vcsh.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

hook to install pre-commit gitignore management hook
authormartin f. krafft <madduck@madduck.net>
Thu, 1 May 2025 08:11:02 +0000 (10:11 +0200)
committermartin f. krafft <madduck@madduck.net>
Thu, 1 May 2025 08:27:31 +0000 (10:27 +0200)
.config/vcsh/hooks-available/install-gitignore-pre-commit-hook [new file with mode: 0755]
.config/vcsh/hooks-enabled/post-clone.gitignore-hook [new symlink]
.config/vcsh/hooks-enabled/post-init.gitignore-hook [new symlink]
.gitignore.d/vcsh

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 (executable)
index 0000000..5bfc972
--- /dev/null
@@ -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 (symlink)
index 0000000..387e84e
--- /dev/null
@@ -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 (symlink)
index 0000000..387e84e
--- /dev/null
@@ -0,0 +1 @@
+../hooks-available/install-gitignore-pre-commit-hook
\ No newline at end of file
index 11f4cc9340dfbc702be4afacf6dfb4fa5b8d3a72..6c53f09dd42476d1fed9d9e877d951f2f1e7402f 100644 (file)
@@ -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