Fork for workshops

Committer:
JimCarver
Date:
Fri Oct 12 21:22:49 2018 +0000
Revision:
0:6b753f761943
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JimCarver 0:6b753f761943 1 #!/bin/sh
JimCarver 0:6b753f761943 2 #
JimCarver 0:6b753f761943 3 # An example hook script to prepare the commit log message.
JimCarver 0:6b753f761943 4 # Called by "git commit" with the name of the file that has the
JimCarver 0:6b753f761943 5 # commit message, followed by the description of the commit
JimCarver 0:6b753f761943 6 # message's source. The hook's purpose is to edit the commit
JimCarver 0:6b753f761943 7 # message file. If the hook fails with a non-zero status,
JimCarver 0:6b753f761943 8 # the commit is aborted.
JimCarver 0:6b753f761943 9 #
JimCarver 0:6b753f761943 10 # To enable this hook, rename this file to "prepare-commit-msg".
JimCarver 0:6b753f761943 11
JimCarver 0:6b753f761943 12 # This hook includes three examples. The first comments out the
JimCarver 0:6b753f761943 13 # "Conflicts:" part of a merge commit.
JimCarver 0:6b753f761943 14 #
JimCarver 0:6b753f761943 15 # The second includes the output of "git diff --name-status -r"
JimCarver 0:6b753f761943 16 # into the message, just before the "git status" output. It is
JimCarver 0:6b753f761943 17 # commented because it doesn't cope with --amend or with squashed
JimCarver 0:6b753f761943 18 # commits.
JimCarver 0:6b753f761943 19 #
JimCarver 0:6b753f761943 20 # The third example adds a Signed-off-by line to the message, that can
JimCarver 0:6b753f761943 21 # still be edited. This is rarely a good idea.
JimCarver 0:6b753f761943 22
JimCarver 0:6b753f761943 23 case "$2,$3" in
JimCarver 0:6b753f761943 24 merge,)
JimCarver 0:6b753f761943 25 /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
JimCarver 0:6b753f761943 26
JimCarver 0:6b753f761943 27 # ,|template,)
JimCarver 0:6b753f761943 28 # /usr/bin/perl -i.bak -pe '
JimCarver 0:6b753f761943 29 # print "\n" . `git diff --cached --name-status -r`
JimCarver 0:6b753f761943 30 # if /^#/ && $first++ == 0' "$1" ;;
JimCarver 0:6b753f761943 31
JimCarver 0:6b753f761943 32 *) ;;
JimCarver 0:6b753f761943 33 esac
JimCarver 0:6b753f761943 34
JimCarver 0:6b753f761943 35 # SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
JimCarver 0:6b753f761943 36 # grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"