Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
mbed-cloud-client/.git/hooks/prepare-commit-msg.sample@0:c77fc6326067, 2018-03-26 (annotated)
- Committer:
- bogthe
- Date:
- Mon Mar 26 14:52:48 2018 +0000
- Revision:
- 0:c77fc6326067
Initial commit
Who changed what in which revision?
| User | Revision | Line number | New contents of line | 
|---|---|---|---|
| bogthe | 0:c77fc6326067 | 1 | #!/bin/sh | 
| bogthe | 0:c77fc6326067 | 2 | # | 
| bogthe | 0:c77fc6326067 | 3 | # An example hook script to prepare the commit log message. | 
| bogthe | 0:c77fc6326067 | 4 | # Called by "git commit" with the name of the file that has the | 
| bogthe | 0:c77fc6326067 | 5 | # commit message, followed by the description of the commit | 
| bogthe | 0:c77fc6326067 | 6 | # message's source. The hook's purpose is to edit the commit | 
| bogthe | 0:c77fc6326067 | 7 | # message file. If the hook fails with a non-zero status, | 
| bogthe | 0:c77fc6326067 | 8 | # the commit is aborted. | 
| bogthe | 0:c77fc6326067 | 9 | # | 
| bogthe | 0:c77fc6326067 | 10 | # To enable this hook, rename this file to "prepare-commit-msg". | 
| bogthe | 0:c77fc6326067 | 11 | |
| bogthe | 0:c77fc6326067 | 12 | # This hook includes three examples. The first comments out the | 
| bogthe | 0:c77fc6326067 | 13 | # "Conflicts:" part of a merge commit. | 
| bogthe | 0:c77fc6326067 | 14 | # | 
| bogthe | 0:c77fc6326067 | 15 | # The second includes the output of "git diff --name-status -r" | 
| bogthe | 0:c77fc6326067 | 16 | # into the message, just before the "git status" output. It is | 
| bogthe | 0:c77fc6326067 | 17 | # commented because it doesn't cope with --amend or with squashed | 
| bogthe | 0:c77fc6326067 | 18 | # commits. | 
| bogthe | 0:c77fc6326067 | 19 | # | 
| bogthe | 0:c77fc6326067 | 20 | # The third example adds a Signed-off-by line to the message, that can | 
| bogthe | 0:c77fc6326067 | 21 | # still be edited. This is rarely a good idea. | 
| bogthe | 0:c77fc6326067 | 22 | |
| bogthe | 0:c77fc6326067 | 23 | case "$2,$3" in | 
| bogthe | 0:c77fc6326067 | 24 | merge,) | 
| bogthe | 0:c77fc6326067 | 25 | /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;; | 
| bogthe | 0:c77fc6326067 | 26 | |
| bogthe | 0:c77fc6326067 | 27 | # ,|template,) | 
| bogthe | 0:c77fc6326067 | 28 | # /usr/bin/perl -i.bak -pe ' | 
| bogthe | 0:c77fc6326067 | 29 | # print "\n" . `git diff --cached --name-status -r` | 
| bogthe | 0:c77fc6326067 | 30 | # if /^#/ && $first++ == 0' "$1" ;; | 
| bogthe | 0:c77fc6326067 | 31 | |
| bogthe | 0:c77fc6326067 | 32 | *) ;; | 
| bogthe | 0:c77fc6326067 | 33 | esac | 
| bogthe | 0:c77fc6326067 | 34 | |
| bogthe | 0:c77fc6326067 | 35 | # SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') | 
| bogthe | 0:c77fc6326067 | 36 | # grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" |