{"thread":{"id":"64594","subject":"[PATCH] doc: join default pre-commit paragraphs","startedAt":"2025-12-08T07:27:30Z","lastAt":"2025-12-08T07:27:30Z","messageCount":1,"participants":["kristofferhaugsbakk@fastmail.com"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"531811","messageId":"pre-commit_when_enabled.10a@msgid.xyz","threadId":"64594","inReplyTo":null,"subject":"[PATCH] doc: join default pre-commit paragraphs","fromName":"","fromEmail":"kristofferhaugsbakk@fastmail.com","sentAt":"2025-12-08T07:27:11Z","receivedAt":"2025-12-08T07:27:30Z","isPatch":true,"sender":{"key":"kristofferhaugsbakk@fastmail.com","avatar":null},"body":"From: Kristoffer Haugsbakk <code@khaugsbakk.name>\n\nJoin two paragraphs that start with the standard “The default <hook>,\nwhen enabled” into one and put it at the end of the “pre-commit”\nsection.\n\nThe trailing whitespace paragraph was added in the first commit for the\ndoc, in 6d35cc76 (Document hooks., 2005-09-02). Then 3e14dd2c (mention\nuse of \"hooks.allownonascii\" in \"man githooks\", 2019-02-20) updated the\n“pre-commit” section to mention the non-ASCII check that was added in\nd00e364d.[1] But this paragraph was added one-past the original\n“default” paragraph, after the env. variable paragraph, and starts\nexactly the same. That causes the flow of this section to feel\noff (paragraphs in order):\n\n1. Invoked by <cmd> and what parameters it takes\n2. The default 'pre-commit' hook catches introduction of trailing\n   whitespace\n3. `GIT_EDITOR=:`\n4. The default pre-commit' hook catches introduction of non-ASCII\n   filenames\n\nLet’s instead join these two paragrahs and explain the whole behavior of\nthe default script.\n\n† 1: Extend sample pre-commit hook to check for non ascii filenames,\n     2009-05-19\n\nSigned-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n---\n Documentation/githooks.adoc | 11 ++++-------\n 1 file changed, 4 insertions(+), 7 deletions(-)\n\ndiff --git a/Documentation/githooks.adoc b/Documentation/githooks.adoc\nindex 0397dec64d7..056553788d4 100644\n--- a/Documentation/githooks.adoc\n+++ b/Documentation/githooks.adoc\n@@ -103,17 +103,14 @@ invoked before obtaining the proposed commit log message and\n making a commit.  Exiting with a non-zero status from this script\n causes the `git commit` command to abort before creating a commit.\n \n-The default 'pre-commit' hook, when enabled, catches introduction\n-of lines with trailing whitespaces and aborts the commit when\n-such a line is found.\n-\n All the `git commit` hooks are invoked with the environment\n variable `GIT_EDITOR=:` if the command will not bring up an editor\n to modify the commit message.\n \n-The default 'pre-commit' hook, when enabled--and with the\n-`hooks.allownonascii` config option unset or set to false--prevents\n-the use of non-ASCII filenames.\n+The default 'pre-commit' hook, when enabled, prevents the introduction\n+of non-ASCII filenames and lines with trailing whitespace. The non-ASCII\n+check can be turned off by setting the `hooks.allownonascii` config\n+option to `true`.\n \n pre-merge-commit\n ~~~~~~~~~~~~~~~~\n\nbase-commit: 9a2fb147f2c61d0cab52c883e7e26f5b7948e3ed\n-- \n2.52.0.10.g08704017180\n\n"}]}