Skip to content

Commit b22a307

Browse files
Kaartic Sivaraamgitster
authored andcommitted
hook: cleanup script
Prepare the 'preare-commit-msg' sample script for upcoming changes. Preparation includes removal of an example that has outlived it's purpose. The example is the one that comments the "Conflicts:" part of a merge commit message. It isn't relevant anymore as it's done by default since 261f315 ("merge & sequencer: turn "Conflicts:" hint into a comment", 2014-08-28). Further update the relevant comments from the sample script and update the documentation. Signed-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 8b2efe2 commit b22a307

File tree

2 files changed

+10
-17
lines changed

2 files changed

+10
-17
lines changed

Documentation/githooks.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,6 @@ it is not suppressed by the `--no-verify` option. A non-zero exit
121121
means a failure of the hook and aborts the commit. It should not
122122
be used as replacement for pre-commit hook.
123123

124-
The sample `prepare-commit-msg` hook that comes with Git comments
125-
out the `Conflicts:` part of a merge's commit message.
126-
127124
commit-msg
128125
~~~~~~~~~~
129126

templates/hooks--prepare-commit-msg.sample

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,24 @@
99
#
1010
# To enable this hook, rename this file to "prepare-commit-msg".
1111

12-
# This hook includes three examples. The first comments out the
13-
# "Conflicts:" part of a merge commit.
12+
# This hook includes two examples.
1413
#
15-
# The second includes the output of "git diff --name-status -r"
14+
# The first includes the output of "git diff --name-status -r"
1615
# into the message, just before the "git status" output. It is
1716
# commented because it doesn't cope with --amend or with squashed
1817
# commits.
1918
#
20-
# The third example adds a Signed-off-by line to the message, that can
19+
# The second example adds a Signed-off-by line to the message, that can
2120
# still be edited. This is rarely a good idea.
2221

23-
case "$2,$3" in
24-
merge,)
25-
@PERL_PATH@ -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
2622

27-
# ,|template,)
28-
# @PERL_PATH@ -i.bak -pe '
29-
# print "\n" . `git diff --cached --name-status -r`
30-
# if /^#/ && $first++ == 0' "$1" ;;
31-
32-
*) ;;
33-
esac
23+
# case "$2,$3" in
24+
# ,|template,)
25+
# @PERL_PATH@ -i.bak -pe '
26+
# print "\n" . `git diff --cached --name-status -r`
27+
# if /^#/ && $first++ == 0' "$1" ;;
28+
# *) ;;
29+
# esac
3430

3531
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
3632
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"

0 commit comments

Comments
 (0)