FRDM K64F Metronome

Committer:
ram54288
Date:
Sun May 14 18:37:05 2017 +0000
Revision:
0:dbad57390bd1
Initial commit

Who changed what in which revision?

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