Mercurial > lasercutter
diff graster/hacklab-engraver/.git/hooks/prepare-commit-msg.sample @ 11:f952052e37b7
trying a fix.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 24 Aug 2010 19:06:45 -0400 |
parents | |
children |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/graster/hacklab-engraver/.git/hooks/prepare-commit-msg.sample Tue Aug 24 19:06:45 2010 -0400 1.3 @@ -0,0 +1,36 @@ 1.4 +#!/bin/sh 1.5 +# 1.6 +# An example hook script to prepare the commit log message. 1.7 +# Called by git-commit with the name of the file that has the 1.8 +# commit message, followed by the description of the commit 1.9 +# message's source. The hook's purpose is to edit the commit 1.10 +# message file. If the hook fails with a non-zero status, 1.11 +# the commit is aborted. 1.12 +# 1.13 +# To enable this hook, rename this file to "prepare-commit-msg". 1.14 + 1.15 +# This hook includes three examples. The first comments out the 1.16 +# "Conflicts:" part of a merge commit. 1.17 +# 1.18 +# The second includes the output of "git diff --name-status -r" 1.19 +# into the message, just before the "git status" output. It is 1.20 +# commented because it doesn't cope with --amend or with squashed 1.21 +# commits. 1.22 +# 1.23 +# The third example adds a Signed-off-by line to the message, that can 1.24 +# still be edited. This is rarely a good idea. 1.25 + 1.26 +case "$2,$3" in 1.27 + merge,) 1.28 + perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;; 1.29 + 1.30 +# ,|template,) 1.31 +# perl -i.bak -pe ' 1.32 +# print "\n" . `git diff --cached --name-status -r` 1.33 +# if /^#/ && $first++ == 0' "$1" ;; 1.34 + 1.35 + *) ;; 1.36 +esac 1.37 + 1.38 +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') 1.39 +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"