Skip to contentSkip to conversation

Documentation: fix description for enabling hooks

PATCH In review Markus Heidelberg 3 participants 6 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Documentation: fix description for enabling hooks

Since f98f8cb (Ship sample hooks with .sample suffix, 2008-06-24) hooks are not enabled by making them executable anymore, but by removing the '.sample' suffix from the filename.

---
 Documentation/gitrepository-layout.txt |    3 ++-
 Documentation/glossary-content.txt     |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
Documentation/gitrepository-layout.txt +2 -1
index a969b3f..1befca9 100644
@@ -134,7 +134,8 @@ hooks::
 	Hooks are customization scripts used by various git
 	commands.  A handful of sample hooks are installed when
 	'git-init' is run, but all of them are disabled by
-	default.  To enable, they need to be made executable.
+	default.  To enable, the `.sample` suffix has to be
+	removed from the filename by renaming.
 	Read linkgit:githooks[5] for more details about
 	each hook.
 
Documentation/glossary-content.txt +2 -1
index 9b4a4f4..9afca75 100644
@@ -183,7 +183,8 @@ to point at the new commit.
 	and potentially aborted, and allow for a post-notification after the
 	operation is done. The hook scripts are found in the
 	`$GIT_DIR/hooks/` directory, and are enabled by simply
-	making them executable.
+	removing the `.sample` suffix from the filename. In earlier versions
+	of git you had to make them executable.
 
 [[def_index]]index::
 	A collection of files with stat information, whose contents are stored
Signature · 1 line
1.6.1.rc3.23.gaf48b
#1 lore raw
Quoted 3 lines · Markus Heidelberg

Since f98f8cb (Ship sample hooks with .sample suffix, 2008-06-24) hooks are not enabled by making them executable anymore, but by removing the '.sample' suffix from the filename.

This is true, but having the executable bit is necessary as well. I think it would be better to just append this requirement instead of replacing the old one with this.

#2 lore raw
Quoted 8 lines · Miklos Vajna
Quoted 3 lines · Markus Heidelberg

Since f98f8cb (Ship sample hooks with .sample suffix, 2008-06-24) hooks are not enabled by making them executable anymore, but by removing the '.sample' suffix from the filename.

This is true, but having the executable bit is necessary as well. I think it would be better to just append this requirement instead of replacing the old one with this.

Markus's proposed new wording is correct because the .sample hooks *are* already executable.

-- Hannes

#3 lore raw
Quoted 6 lines · Johannes Sixt
Quoted 3 lines

This is true, but having the executable bit is necessary as well. I think it would be better to just append this requirement instead of replacing the old one with this.

Markus's proposed new wording is correct because the .sample hooks *are* already executable.

I thought about the following situation: The user reads the documentation while working in an older repo (initialized a few versions ago). S/he sees that the .sample suffix is already missing, so s/he assumes that the hook is already active. Which is not true, because the +x bit is missing.

#4 lore raw

Miklos Vajna, 17.12.2008:

Quoted 5 lines · Johannes Sixt
Quoted 4 lines
Quoted 3 lines

This is true, but having the executable bit is necessary as well. I think it would be better to just append this requirement instead of replacing the old one with this.

Quoted 8 lines
Quoted 2 lines

Markus's proposed new wording is correct because the .sample hooks *are* already executable.

I thought about the following situation: The user reads the documentation while working in an older repo (initialized a few versions ago). S/he sees that the .sample suffix is already missing, so s/he assumes that the hook is already active. Which is not true, because the +x bit is missing.

Valid point, I think, but not critical in this case, since the patch only affected gitrepository-layout(5) and gitglossary(7).

When you want to learn how to use hooks, you will probably rather read githooks(5), where the need for the executable bit is not even explicitly mentioned. Maybe it should be added there?

Markus

#5 lore raw

PATCH 1/1 githooks documentation: add a note about the +x mode

In a freshly initialized repo it is only necessary to rename the .sample hooks, but when using older repos (initialized with older git init) enabled the +x mode is still necessary - docuement this.

---

Quoted 3 lines · Markus Heidelberg

When you want to learn how to use hooks, you will probably rather read githooks(5), where the need for the executable bit is not even explicitly mentioned. Maybe it should be added there?

I think so.

 Documentation/githooks.txt |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
Documentation/githooks.txt +4 -0
index 5faaaa5..cfdae1e 100644
@@ -20,6 +20,10 @@ directory to trigger action at certain points.  When
 all disabled.  To enable a hook, rename it by removing its `.sample`
 suffix.
 
+NOTE: It is also a requirement for a given hook to be executable.
+However - in a freshly initialized repository - the `.sample` files are
+executable by default.
+
 This document describes the currently defined hooks.
 
 applypatch-msg
Signature · 1 line
1.6.1.rc1.35.gae26e.dirty