Skip to content

Commit 100e762

Browse files
Ben Waltongitster
authored andcommitted
Modernize git calling conventions in hook templates
The hook templates were still using/referencing 'git-foo' instead of 'git foo.' This patch updates the sample hooks to use the modern conventions instead. Signed-off-by: Ben Walton <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 502be95 commit 100e762

7 files changed

+17
-17
lines changed

templates/hooks--commit-msg.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22
#
33
# An example hook script to check the commit log message.
4-
# Called by git-commit with one argument, the name of the file
4+
# Called by "git commit" with one argument, the name of the file
55
# that has the commit message. The hook should exit with non-zero
66
# status after issuing an appropriate message if it wants to stop the
77
# commit. The hook is allowed to edit the commit message file.

templates/hooks--post-update.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
#
66
# To enable this hook, rename this file to "post-update".
77

8-
exec git-update-server-info
8+
exec git update-server-info

templates/hooks--pre-commit.sample

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/bin/sh
22
#
33
# An example hook script to verify what is about to be committed.
4-
# Called by git-commit with no arguments. The hook should
4+
# Called by "git commit" with no arguments. The hook should
55
# exit with non-zero status after issuing an appropriate message if
66
# it wants to stop the commit.
77
#
88
# To enable this hook, rename this file to "pre-commit".
99

10-
if git-rev-parse --verify HEAD >/dev/null 2>&1
10+
if git rev-parse --verify HEAD >/dev/null 2>&1
1111
then
1212
against=HEAD
1313
else

templates/hooks--pre-rebase.sample

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# Copyright (c) 2006, 2008 Junio C Hamano
44
#
5-
# The "pre-rebase" hook is run just before "git-rebase" starts doing
5+
# The "pre-rebase" hook is run just before "git rebase" starts doing
66
# its job, and can prevent the command from running by exiting with
77
# non-zero status.
88
#
@@ -43,19 +43,19 @@ git show-ref -q "$topic" || {
4343
}
4444

4545
# Is topic fully merged to master?
46-
not_in_master=`git-rev-list --pretty=oneline ^master "$topic"`
46+
not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
4747
if test -z "$not_in_master"
4848
then
4949
echo >&2 "$topic is fully merged to master; better remove it."
5050
exit 1 ;# we could allow it, but there is no point.
5151
fi
5252

5353
# Is topic ever merged to next? If so you should not be rebasing it.
54-
only_next_1=`git-rev-list ^master "^$topic" ${publish} | sort`
55-
only_next_2=`git-rev-list ^master ${publish} | sort`
54+
only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
55+
only_next_2=`git rev-list ^master ${publish} | sort`
5656
if test "$only_next_1" = "$only_next_2"
5757
then
58-
not_in_topic=`git-rev-list "^$topic" master`
58+
not_in_topic=`git rev-list "^$topic" master`
5959
if test -z "$not_in_topic"
6060
then
6161
echo >&2 "$topic is already up-to-date with master"
@@ -64,7 +64,7 @@ then
6464
exit 0
6565
fi
6666
else
67-
not_in_next=`git-rev-list --pretty=oneline ^${publish} "$topic"`
67+
not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
6868
@PERL_PATH@ -e '
6969
my $topic = $ARGV[0];
7070
my $msg = "* $topic has commits already merged to public branch:\n";
@@ -157,13 +157,13 @@ B to be deleted.
157157
158158
To compute (1):
159159
160-
git-rev-list ^master ^topic next
161-
git-rev-list ^master next
160+
git rev-list ^master ^topic next
161+
git rev-list ^master next
162162
163163
if these match, topic has not merged in next at all.
164164
165165
To compute (2):
166166
167-
git-rev-list master..topic
167+
git rev-list master..topic
168168
169169
if this is empty, it is fully merged to "master".

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22
#
33
# An example hook script to prepare the commit log message.
4-
# Called by git-commit with the name of the file that has the
4+
# Called by "git commit" with the name of the file that has the
55
# commit message, followed by the description of the commit
66
# message's source. The hook's purpose is to edit the commit
77
# message file. If the hook fails with a non-zero status,

templates/hooks--update.sample

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22
#
33
# An example hook script to blocks unannotated tags from entering.
4-
# Called by git-receive-pack with arguments: refname sha1-old sha1-new
4+
# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
55
#
66
# To enable this hook, rename this file to "update".
77
#
@@ -64,7 +64,7 @@ zero="0000000000000000000000000000000000000000"
6464
if [ "$newrev" = "$zero" ]; then
6565
newrev_type=delete
6666
else
67-
newrev_type=$(git-cat-file -t $newrev)
67+
newrev_type=$(git cat-file -t $newrev)
6868
fi
6969

7070
case "$refname","$newrev_type" in

templates/info--exclude

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# git-ls-files --others --exclude-from=.git/info/exclude
1+
# git ls-files --others --exclude-from=.git/info/exclude
22
# Lines that start with '#' are comments.
33
# For a project mostly in C, the following would be a good set of
44
# exclude patterns (uncomment them if you want to use them):

0 commit comments

Comments
 (0)