Ship sample hooks with .sample suffix
We used to mark hooks we ship as samples by making them unexecutable, but some filesystems cannot tell what is executable and what is not. This makes it much more explicit. The hooks are suffixed with .sample (but now are made executable), so enabling it is still one step operation (instead of "chmod +x $hook", you would do "mv $hook.sample $hook") but now they won't get accidentally enabled on systems without executable bit. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Jun 24, 2008 at 18:45 UTC
f98f8cbac01e0d5dbb30660d7ea70af6a1439dfd
12 files changed
+25
-25
Documentation/githooks.txt
+2
-1
@@ -17,7 +17,8 @@ Hooks are little scripts you can place in `$GIT_DIR/hooks`
17
directory to trigger action at certain points. When
18
`git-init` is run, a handful example hooks are copied in the
19
`hooks` directory of the new repository, but by default they are
20
-all disabled. To enable a hook, make it executable with `chmod +x`.
20
+all disabled. To enable a hook, rename it by removing its `.sample`
21
+suffix.
22
23
This document describes the currently defined hooks.
24
templates/hooks--applypatch-msg.sample
renamed
+1
-1
@@ -7,7 +7,7 @@
7
# appropriate message if it wants to stop the commit. The hook is
8
# allowed to edit the commit message file.
9
#
10
-# To enable this hook, make this file executable.
10
+# To enable this hook, rename this file to "applypatch-msg".
11
12
. git-sh-setup
13
test -x "$GIT_DIR/hooks/commit-msg" &&
templates/hooks--commit-msg.sample
renamed
+1
-1
@@ -6,7 +6,7 @@
6
# status after issuing an appropriate message if it wants to stop the
7
# commit. The hook is allowed to edit the commit message file.
8
#
9
-# To enable this hook, make this file executable.
9
+# To enable this hook, rename this file to "commit-msg".
10
11
# Uncomment the below to add a Signed-off-by line to the message.
12
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
templates/hooks--post-commit.sample
renamed
+1
-1
@@ -3,6 +3,6 @@
3
# An example hook script that is called after a successful
4
# commit is made.
5
#
6
-# To enable this hook, make this file executable.
6
+# To enable this hook, rename this file to "post-commit".
7
8
: Nothing
templates/hooks--post-receive
deleted
-16
@@ -1,16 +0,0 @@
1
-#!/bin/sh
2
-#
3
-# An example hook script for the post-receive event
4
-#
5
-# This script is run after receive-pack has accepted a pack and the
6
-# repository has been updated. It is passed arguments in through stdin
7
-# in the form
8
-# <oldrev> <newrev> <refname>
9
-# For example:
10
-# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
11
-#
12
-# see contrib/hooks/ for an sample, or uncomment the next line (on debian)
13
-#
14
-
15
-
16
-#. /usr/share/doc/git-core/contrib/hooks/post-receive-email
templates/hooks--post-receive.sample
new
+15
@@ -0,0 +1,15 @@
1
+#!/bin/sh
2
+#
3
+# An example hook script for the "post-receive" event.
4
+#
5
+# The "post-receive" script is run after receive-pack has accepted a pack
6
+# and the repository has been updated. It is passed arguments in through
7
+# stdin in the form
8
+# <oldrev> <newrev> <refname>
9
+# For example:
10
+# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
11
+#
12
+# see contrib/hooks/ for an sample, or uncomment the next line and
13
+# rename the file to "post-receive".
14
+
15
+#. /usr/share/doc/git-core/contrib/hooks/post-receive-email
templates/hooks--post-update.sample
renamed
+1
-1
@@ -3,6 +3,6 @@
3
# An example hook script to prepare a packed repository for use over
4
# dumb transports.
5
#
6
-# To enable this hook, make this file executable by "chmod +x post-update".
6
+# To enable this hook, rename this file to "post-update".
7
8
exec git-update-server-info
templates/hooks--pre-applypatch.sample
renamed
+1
-1
@@ -6,7 +6,7 @@
6
# The hook should exit with non-zero status after issuing an
7
# appropriate message if it wants to stop the commit.
8
#
9
-# To enable this hook, make this file executable.
9
+# To enable this hook, rename this file to "pre-applypatch".
10
11
. git-sh-setup
12
test -x "$GIT_DIR/hooks/pre-commit" &&
templates/hooks--pre-commit.sample
renamed
+1
-1
@@ -5,7 +5,7 @@
5
# exit with non-zero status after issuing an appropriate message if
6
# it wants to stop the commit.
7
#
8
-# To enable this hook, make this file executable.
8
+# To enable this hook, rename this file to "pre-commit".
9
10
# This is slightly modified from Andrew Morton's Perfect Patch.
11
# Lines you introduce should not have trailing whitespace.
templates/hooks--pre-rebase.sample
renamed
templates/hooks--prepare-commit-msg.sample
renamed
+1
-1
@@ -7,7 +7,7 @@
7
# message file. If the hook fails with a non-zero status,
8
# the commit is aborted.
9
#
10
-# To enable this hook, make this file executable.
10
+# To enable this hook, rename this file to "prepare-commit-msg".
11
12
# This hook includes three examples. The first comments out the
13
# "Conflicts:" part of a merge commit.
templates/hooks--update.sample
renamed
+1
-1
@@ -3,7 +3,7 @@
3
# An example hook script to blocks unannotated tags from entering.
4
# Called by git-receive-pack with arguments: refname sha1-old sha1-new
5
#
6
-# To enable this hook, make this file executable by "chmod +x update".
6
+# To enable this hook, rename this file to "update".
7
#
8
# Config
9
# ------