]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - tools/tools/git/hooks/prepare-commit-msg
chmod +x the git commit message prep hook
[FreeBSD/FreeBSD.git] / tools / tools / git / hooks / prepare-commit-msg
1 #!/bin/sh
2
3 case "$2" in
4 commit|message)
5         # It appears git invokes this script for interactive rebase but does
6         # not remove commented lines, so just exit if we're not called with the
7         # default (comment-containing) template.
8         egrep -q '^#' "$1" || return 0
9         ;;
10 template)
11         return 0
12         ;;
13 merge)
14         return 0
15         ;;
16 esac
17
18 outfile=$(mktemp /tmp/freebsd-git-commit.XXXXXXXX)
19 cat >$outfile <<EOF
20
21 $(awk '1;/^#$/{exit}' $1)
22 # Uncomment and complete these metadata fields, as appropriate:
23
24 # PR:           
25 # Submitted by: 
26 # Reported by:  
27 # Reviewed by:  
28 # Approved by:  
29 # Obtained from:        
30 # MFC after:    
31 # MFH:          
32 # Relnotes:     
33 # Security:     
34 # Sponsored by: 
35 # Pull Request: 
36 # Differential Revision:        
37 #
38 # Description of fields to fill in above:                 72 columns --|
39 # PR:                       If and which Problem Report is related.
40 # Submitted by:             If someone else sent in the change.
41 # Reported by:              If someone else reported the issue.
42 # Reviewed by:              If someone else reviewed your modification.
43 # Approved by:              If you needed approval for this commit.
44 # Obtained from:            If the change is from a third party.
45 # MFC after:                N [day[s]|week[s]|month[s]].  Request a reminder email.
46 # MFH:                      Ports tree branch name.  Request approval for merge.
47 # Relnotes:                 Set to 'yes' for mention in release notes.
48 # Security:                 Vulnerability reference (one per line) or description.
49 # Sponsored by:             If the change was sponsored by an organization.
50 # Pull Request:             https://github.com/freebsd/<repo>/pull/### (*full* GitHub URL needed).
51 # Differential Revision:    https://reviews.freebsd.org/D### (*full* phabric URL needed).
52 $(awk '/^#$/,EOF' $1)
53 EOF
54
55 mv $outfile $1