File: commit-msg

package info (click to toggle)
trilinos 16.1.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 994,012 kB
  • sloc: cpp: 3,764,859; ansic: 425,011; fortran: 160,684; python: 101,476; xml: 74,329; sh: 37,044; makefile: 22,641; perl: 7,525; f90: 6,424; csh: 5,285; objc: 2,620; lex: 1,646; lisp: 810; yacc: 603; javascript: 552; awk: 364; ml: 281; php: 145
file content (34 lines) | stat: -rwxr-xr-x 1,003 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python
#
# Check to make sure commit message is formatted correctly
#

import sys

commitLogFileName = sys.argv[1]
commitLogFileStr = open(commitLogFileName, "r").read()

firstLine = commitLogFileStr.splitlines()[0]

firstLineLen = len(firstLine)
maxSummaryLen = 120
suggestedSummaryLen = 72

if (firstLineLen > maxSummaryLen):
  print("***")
  print("*** ERROR: Summary line is "+str(firstLineLen)+" > "+str(maxSummaryLen)+" chars long!  Commit rejected!")
  print("***")
  print("*** Summary line: "+firstLine)
  print("***")
  print("*** NOTE: Your rejected commit message is in the file ./git/COMMIT_EDITMSG")
  print("***")
  sys.exit(1)
elif (firstLineLen > suggestedSummaryLen):
  print("***")
  print("*** WARNING: Summary line is "+str(firstLineLen)+" > "+str(suggestedSummaryLen)+" chars long!")
  print("***")
  print("*** NOTE: Please use 'git commit --amend' to reduce length of summary line!")
  print("***")

# If we get here then it is okay to make the commit
sys.exit(0)