util: Break up some unit tests in the m5 utility.
[gem5.git] / util / git-commit-msg.py
index 2bddf12839c8e52499a4cdad80d2fdd9e413da2d..b2ff164522b17d9b16e114990f1bd88dd2e2d698 100755 (executable)
@@ -46,7 +46,7 @@ def _printErrorQuit(error_message):
     print(error_message)
 
     print("The commit has been cancelled, but a copy of it can be found in "
-            + sys.argv[1] + " : ")
+          + sys.argv[1] + " : ")
 
     print("""
 --------------------------------------------------------------------------
@@ -109,10 +109,12 @@ commit_message = open(sys.argv[1]).read()
 commit_message_lines = commit_message.splitlines()
 commit_header = commit_message_lines[0]
 commit_header_match = \
-    re.search("^(\S[\w\-][,\s*[\w\-]+]*:.+\S$)", commit_header)
+    re.search("^(fixup! )?(\S[\w\-][,\s*[\w\-]+]*:.+\S$)", commit_header)
 if ((commit_header_match is None)):
     _printErrorQuit("Invalid commit header")
-_validateTags(commit_header)
+if commit_header_match.group(1) == "fixup! ":
+    sys.exit(0)
+_validateTags(commit_header_match.group(2))
 
 # Make sure commit title does not exceed threshold. This line is limited to
 # a smaller number because version control systems may add a prefix, causing