Browse Source

Merge pull request #5751 from heyitsanthony/fail-bad-commit-msg

test: check commit titles
Anthony Romano 9 years ago
parent
commit
6fbf8be3ac
1 changed files with 19 additions and 0 deletions
  1. 19 0
      test

+ 19 - 0
test

@@ -146,6 +146,25 @@ function fmt_tests {
 		echo -e "license header checking failed:\n${licRes}"
 		exit 255
 	fi
+
+	echo "Checking commit titles..."
+	git log master..HEAD --oneline | while read l; do
+		pfx=`echo "$l" | cut -f2 -d' '`
+		if [ "$pfx" == "Merge" ]; then
+			# ignore "Merge pull" commits
+			continue
+		fi
+		if [ "$pfx" == "Revert" ]; then
+			# ignore revert commits
+			continue
+		fi
+		if ! [[ "$pfx" =~ :$ ]]; then
+			echo "$pfx"...
+			echo "Expected commit title format '<package>: <description>'"
+			echo "Got: $l"
+			exit 255
+		fi
+	done
 }
 
 function dep_tests {