summaryrefslogtreecommitdiffstats
path: root/githooks.html
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-05-17 15:27:24 -0700
committerJunio C Hamano <gitster@pobox.com>2016-05-17 15:27:24 -0700
commit198b1f1fbb7b9bb186d3e7bc86f62813bccc396a (patch)
tree78a3fb45dce6ca0bf5c13f3446ecc7b91e753036 /githooks.html
parenteda40534055629f4ae708ab5ab19c317d2161e42 (diff)
downloadgit-htmldocs-198b1f1fbb7b9bb186d3e7bc86f62813bccc396a.tar.gz
Autogenerated HTML docs for v2.8.2-534-g1f669
Diffstat (limited to 'githooks.html')
-rw-r--r--githooks.html79
1 files changed, 41 insertions, 38 deletions
diff --git a/githooks.html b/githooks.html
index 7460b04bc..fecefd467 100644
--- a/githooks.html
+++ b/githooks.html
@@ -747,29 +747,30 @@ githooks(5) Manual Page
<div class="sect1">
<h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
-<div class="paragraph"><p>$GIT_DIR/hooks/*</p></div>
+<div class="paragraph"><p>$GIT_DIR/hooks/* (or `git config core.hooksPath`/*)</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
-<div class="paragraph"><p>Hooks are little scripts you can place in <code>$GIT_DIR/hooks</code>
-directory to trigger action at certain points. When
-<em>git init</em> is run, a handful of example hooks are copied into the
-<code>hooks</code> directory of the new repository, but by default they are
-all disabled. To enable a hook, rename it by removing its <code>.sample</code>
-suffix.</p></div>
-<div class="admonitionblock">
-<table><tr>
-<td class="icon">
-<div class="title">Note</div>
-</td>
-<td class="content">It is also a requirement for a given hook to be executable.
-However - in a freshly initialized repository - the <code>.sample</code> files are
-executable by default.</td>
-</tr></table>
-</div>
-<div class="paragraph"><p>This document describes the currently defined hooks.</p></div>
+<div class="paragraph"><p>Hooks are programs you can place in a hooks directory to trigger
+actions at certain points in git&#8217;s execution. Hooks that don&#8217;t have
+the executable bit set are ignored.</p></div>
+<div class="paragraph"><p>By default the hooks directory is <code>$GIT_DIR/hooks</code>, but that can be
+changed via the <code>core.hooksPath</code> configuration variable (see
+<a href="git-config.html">git-config(1)</a>).</p></div>
+<div class="paragraph"><p>Before Git invokes a hook, it changes its working directory to either
+the root of the working tree in a non-bare repository, or to the
+$GIT_DIR in a bare repository.</p></div>
+<div class="paragraph"><p>Hooks can get their arguments via the environment, command-line
+arguments, and stdin. See the documentation for each hook below for
+details.</p></div>
+<div class="paragraph"><p><em>git init</em> may copy hooks to the new repository, depending on its
+configuration. See the "TEMPLATE DIRECTORY" section in
+<a href="git-init.html">git-init(1)</a> for details. When the rest of this document refers
+to "default hooks" it&#8217;s talking about the default template shipped
+with Git.</p></div>
+<div class="paragraph"><p>The currently supported hooks are described below.</p></div>
</div>
</div>
<div class="sect1">
@@ -777,14 +778,14 @@ executable by default.</td>
<div class="sectionbody">
<div class="sect2">
<h3 id="_applypatch_msg">applypatch-msg</h3>
-<div class="paragraph"><p>This hook is invoked by <em>git am</em> script. It takes a single
+<div class="paragraph"><p>This hook is invoked by <em>git am</em>. It takes a single
parameter, the name of the file that holds the proposed commit
-log message. Exiting with non-zero status causes
-<em>git am</em> to abort before applying the patch.</p></div>
+log message. Exiting with a non-zero status causes <em>git am</em> to abort
+before applying the patch.</p></div>
<div class="paragraph"><p>The hook is allowed to edit the message file in place, and can
be used to normalize the message into some project standard
-format (if the project has one). It can also be used to refuse
-the commit after inspecting the message file.</p></div>
+format. It can also be used to refuse the commit after inspecting
+the message file.</p></div>
<div class="paragraph"><p>The default <em>applypatch-msg</em> hook, when enabled, runs the
<em>commit-msg</em> hook, if the latter is enabled.</p></div>
</div>
@@ -809,10 +810,10 @@ the outcome of <em>git am</em>.</p></div>
<div class="sect2">
<h3 id="_pre_commit">pre-commit</h3>
<div class="paragraph"><p>This hook is invoked by <em>git commit</em>, and can be bypassed
-with <code>--no-verify</code> option. It takes no parameter, and is
+with the <code>--no-verify</code> option. It takes no parameters, and is
invoked before obtaining the proposed commit log message and
-making a commit. Exiting with non-zero status from this script
-causes the <em>git commit</em> to abort.</p></div>
+making a commit. Exiting with a non-zero status from this script
+causes the <em>git commit</em> command to abort before creating a commit.</p></div>
<div class="paragraph"><p>The default <em>pre-commit</em> hook, when enabled, catches introduction
of lines with trailing whitespaces and aborts the commit when
such a line is found.</p></div>
@@ -843,21 +844,21 @@ out the <code>Conflicts:</code> part of a merge&#8217;s commit message.</p></div
<div class="sect2">
<h3 id="_commit_msg">commit-msg</h3>
<div class="paragraph"><p>This hook is invoked by <em>git commit</em>, and can be bypassed
-with <code>--no-verify</code> option. It takes a single parameter, the
+with the <code>--no-verify</code> option. It takes a single parameter, the
name of the file that holds the proposed commit log message.
-Exiting with non-zero status causes the <em>git commit</em> to
+Exiting with a non-zero status causes the <em>git commit</em> to
abort.</p></div>
-<div class="paragraph"><p>The hook is allowed to edit the message file in place, and can
-be used to normalize the message into some project standard
-format (if the project has one). It can also be used to refuse
-the commit after inspecting the message file.</p></div>
+<div class="paragraph"><p>The hook is allowed to edit the message file in place, and can be used
+to normalize the message into some project standard format. It
+can also be used to refuse the commit after inspecting the message
+file.</p></div>
<div class="paragraph"><p>The default <em>commit-msg</em> hook, when enabled, detects duplicate
"Signed-off-by" lines, and aborts the commit if one is found.</p></div>
</div>
<div class="sect2">
<h3 id="_post_commit">post-commit</h3>
-<div class="paragraph"><p>This hook is invoked by <em>git commit</em>. It takes no
-parameter, and is invoked after a commit is made.</p></div>
+<div class="paragraph"><p>This hook is invoked by <em>git commit</em>. It takes no parameters, and is
+invoked after a commit is made.</p></div>
<div class="paragraph"><p>This hook is meant primarily for notification, and cannot affect
the outcome of <em>git commit</em>.</p></div>
</div>
@@ -986,9 +987,11 @@ That is, to enforce a "fast-forward only" policy.</p></div>
does not know the entire set of branches, so it would end up
firing one e-mail per ref when used naively, though. The
<a href="#post-receive"><em>post-receive</em></a> hook is more suited to that.</p></div>
-<div class="paragraph"><p>Another use suggested on the mailing list is to use this hook to
-implement access control which is finer grained than the one
-based on filesystem group.</p></div>
+<div class="paragraph"><p>In an environment that restricts the users' access only to git
+commands over the wire, this hook can be used to implement access
+control without relying on filesystem ownership and group
+membership. See <a href="git-shell.html">git-shell(1)</a> for how you might use the login
+shell to restrict the user&#8217;s access to only git commands.</p></div>
<div class="paragraph"><p>Both standard output and standard error output are forwarded to
<em>git send-pack</em> on the other end, so you can simply <code>echo</code> messages
for the user.</p></div>
@@ -1124,7 +1127,7 @@ processed by rebase.</p></div>
<div id="footnotes"><hr /></div>
<div id="footer">
<div id="footer-text">
-Last updated 2016-03-21 13:49:04 PDT
+Last updated 2016-05-17 15:26:41 PDT
</div>
</div>
</body>