git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: <git@vger.kernel.org>
Cc: "Jeff King" <peff@peff.net>, "Duy Nguyen" <pclouds@gmail.com>,
	"Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
	"Junio C Hamano" <gitster@pobox.com>,
	"Johannes Sixt" <j6t@kdbg.org>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Phillip Wood" <phillip.wood123@gmail.com>,
	"Jonathan Nieder" <jrnieder@gmail.com>
Subject: [PATCH v2 7/7] docs: document multiple hooks
Date: Tue, 14 May 2019 00:23:32 +0000	[thread overview]
Message-ID: <20190514002332.121089-9-sandals@crustytoothpaste.net> (raw)
In-Reply-To: <20190514002332.121089-1-sandals@crustytoothpaste.net>

Document the semantics and behavior of multiple hooks, including the
configuration options and requirements for them to be run.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 Documentation/config.txt      |  2 ++
 Documentation/config/hook.txt | 19 +++++++++++++++++++
 Documentation/githooks.txt    |  9 +++++++++
 3 files changed, 30 insertions(+)
 create mode 100644 Documentation/config/hook.txt

diff --git a/Documentation/config.txt b/Documentation/config.txt
index d87846faa6..f62b8ce494 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -350,6 +350,8 @@ include::config/guitool.txt[]
 
 include::config/help.txt[]
 
+include::config/hook.txt[]
+
 include::config/http.txt[]
 
 include::config/i18n.txt[]
diff --git a/Documentation/config/hook.txt b/Documentation/config/hook.txt
new file mode 100644
index 0000000000..4585cc7f55
--- /dev/null
+++ b/Documentation/config/hook.txt
@@ -0,0 +1,19 @@
+hook.<name>.errorBehavior::
+  Control the error behavior when using multiple hooks.
++
+--
+* `stop-on-first` - If a hook fails, do not execute further hooks, even if the
+  command normally ignores whether hooks succeed or fail, and return its exit
+  code as the exit code of the hook set. If all hooks succeed, the exit code is 0.
+  This is the default.
+* `report-any-error` - Always execute all hooks, but return the exit code of the
+  first failing hook as the exit code of the hook set. If all hooks succeed, the
+  exit code of the hook set is 0.
+* `report-any-success` - Always execute all hooks, and if any hook succeeds,
+  return 0 as the exit code of the hook set. If all hooks fail, the exit code of
+  the hook set is 1.
+--
++
+If the exit code of the hook set is zero, then the hooks are considered to have
+succeeded; otherwise, they are considered to have failed. Note that the success
+or failure of some hooks is ignored (see linkgit:githooks[5] for more).
diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt
index 786e778ab8..c680e575b3 100644
--- a/Documentation/githooks.txt
+++ b/Documentation/githooks.txt
@@ -31,6 +31,15 @@ Hooks can get their arguments via the environment, command-line
 arguments, and stdin. See the documentation for each hook below for
 details.
 
+It is possible to provide multiple hooks for a single function. If the
+main hook file is absent, hooks are additionally looked for in a
+directory with the name of the main hook file with a `.d` appended.
+(That is, if `post-receive` is missing, `post-receive.d` is inspected
+for any hooks that might be present.) Each of these hooks is executed in order,
+sorted by file name. By default, if a hook fails, additional hooks are not
+executed, but this can be controlled with the `hook.*.errorBehavior` setting
+(see linkgit:git-config[1]).
+
 `git init` may copy hooks to the new repository, depending on its
 configuration. See the "TEMPLATE DIRECTORY" section in
 linkgit:git-init[1] for details. When the rest of this document refers

  parent reply	other threads:[~2019-05-14  0:24 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-14  0:23 [PATCH v2 0/7] Multiple hook support brian m. carlson
2019-05-14  0:23 ` [PATCH v2 1/7] run-command: add preliminary support for multiple hooks brian m. carlson
2019-05-14 12:46   ` Duy Nguyen
2019-05-15 22:27     ` brian m. carlson
2019-05-29  2:18       ` brian m. carlson
2019-05-14 15:12   ` Johannes Schindelin
2019-05-15 22:44     ` brian m. carlson
2019-05-16 19:11       ` Johannes Sixt
2019-05-17 20:31         ` Johannes Schindelin
2019-05-14  0:23 ` [PATCH v2 2/7] builtin/receive-pack: add " brian m. carlson
2019-05-14  0:23 ` [PATCH v2 3/7] rebase: " brian m. carlson
2019-05-14 12:56   ` Duy Nguyen
2019-05-14 17:58     ` Johannes Sixt
2019-05-15 22:55     ` brian m. carlson
2019-05-16 10:29       ` Duy Nguyen
2019-05-14  0:23 ` [PATCH v2 3/7] sequencer: " brian m. carlson
2019-05-14  0:23 ` [PATCH v2 4/7] builtin/worktree: add support for multiple post-checkout hooks brian m. carlson
2019-05-14  0:23 ` [PATCH v2 5/7] transport: add support for multiple pre-push hooks brian m. carlson
2019-05-14  0:23 ` [PATCH v2 6/7] config: allow configuration of multiple hook error behavior brian m. carlson
2019-05-14 13:20   ` Duy Nguyen
2019-05-15 23:10     ` brian m. carlson
2019-05-16  5:08       ` Jeff King
2019-05-16  5:02   ` Jeff King
2019-05-16 17:19     ` brian m. carlson
2019-05-16 21:52       ` Jeff King
2019-05-14  0:23 ` brian m. carlson [this message]
2019-05-14 13:38   ` [PATCH v2 7/7] docs: document multiple hooks Duy Nguyen
2019-05-14  0:51 ` [PATCH v2 0/7] Multiple hook support Jonathan Nieder
2019-05-14  1:59   ` brian m. carlson
2019-05-14  2:26     ` Jonathan Nieder
2019-05-16  0:42       ` brian m. carlson
2019-05-16  0:51         ` Jonathan Nieder
2019-05-16  4:51     ` Jeff King
2019-05-14 13:30 ` Duy Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190514002332.121089-9-sandals@crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=jrnieder@gmail.com \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    --cc=phillip.wood123@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).