FRDM K64F Metronome

Committer:
ram54288
Date:
Sun May 14 18:35:07 2017 +0000
Revision:
0:a2cb7295a1f7
Initial commit

Who changed what in which revision?

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