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