Toyomasa Watarai / simple-mbed-cloud-client

Dependents:  

Committer:
MACRUM
Date:
Mon Jul 02 06:30:39 2018 +0000
Revision:
0:276e7a263c35
Initial commit

Who changed what in which revision?

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