comparison config/dwm/.git/hooks/prepare-commit-msg.sample @ 0:face7f4d84f7

Initial commit
author Yasuri <yasuri@charliesmp.net>
date Mon, 28 Sep 2026 13:10:19 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:face7f4d84f7
1 #!/nix/store/svx59425zxp552p2b8gm11qj5r09b56i-bash-5.3p15/bin/bash
2 #
3 # An example hook script to prepare the commit log message.
4 # Called by "git commit" with the name of the file that has the
5 # commit message, followed by the description of the commit
6 # message's source. The hook's purpose is to edit the commit
7 # message file. If the hook fails with a non-zero status,
8 # the commit is aborted.
9 #
10 # To enable this hook, rename this file to "prepare-commit-msg".
11
12 # This hook includes three examples. The first one removes the
13 # "# Please enter the commit message..." help message.
14 #
15 # The second includes the output of "git diff --name-status -r"
16 # into the message, just before the "git status" output. It is
17 # commented because it doesn't cope with --amend or with squashed
18 # commits.
19 #
20 # The third example adds a Signed-off-by line to the message, that can
21 # still be edited. This is rarely a good idea.
22
23 COMMIT_MSG_FILE=$1
24 COMMIT_SOURCE=$2
25 SHA1=$3
26
27 /nix/store/w03i01kiakf4wz7jbp1l59c0bhb3pjca-perl-5.42.3/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE"
28
29 # case "$COMMIT_SOURCE,$SHA1" in
30 # ,|template,)
31 # /nix/store/w03i01kiakf4wz7jbp1l59c0bhb3pjca-perl-5.42.3/bin/perl -i.bak -pe '
32 # print "\n" . `git diff --cached --name-status -r`
33 # if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;;
34 # *) ;;
35 # esac
36
37 # SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
38 # git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE"
39 # if test -z "$COMMIT_SOURCE"
40 # then
41 # /nix/store/w03i01kiakf4wz7jbp1l59c0bhb3pjca-perl-5.42.3/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE"
42 # fi