Skip to content

Commit 94eba45

Browse files
Kaartic Sivaraamgitster
authored andcommitted
hook: name the positional variables
It's always nice to have named variables instead of positional variables as they communicate their purpose well. Appropriately name the positional variables of the hook to make it easier to see what's going on. Signed-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent b22a307 commit 94eba45

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,17 @@
1919
# The second example adds a Signed-off-by line to the message, that can
2020
# still be edited. This is rarely a good idea.
2121

22+
COMMIT_MSG_FILE=$1
23+
COMMIT_SOURCE=$2
24+
SHA1=$3
2225

23-
# case "$2,$3" in
26+
# case "$COMMIT_SOURCE,$SHA1" in
2427
# ,|template,)
2528
# @PERL_PATH@ -i.bak -pe '
2629
# print "\n" . `git diff --cached --name-status -r`
27-
# if /^#/ && $first++ == 0' "$1" ;;
30+
# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;;
2831
# *) ;;
2932
# esac
3033

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

0 commit comments

Comments
 (0)