Browse Source

[ci] Fix commit message max lenght check

Romain Rigaux 4 năm trước cách đây
mục cha
commit
0e3b21e5dd
2 tập tin đã thay đổi với 11 bổ sung7 xóa
  1. 5 3
      tools/ci/check_for_commit_message.sh
  2. 6 4
      tools/githooks/commit-msg

+ 5 - 3
tools/ci/check_for_commit_message.sh

@@ -18,11 +18,13 @@
 FOUND_ISSUE=0
 IFS=$'\n'
 
-for commit in `git log origin/master..master --format="%s"`
+for commit in `git log origin..HEAD --format="%s"`
 do
- ./tools/githooks/commit-msg "" "$commit"
+  ./tools/githooks/commit-msg "" "$commit"
 
- if [ "$?" -ne "0" ]
+  echo "Checking $commit"
+
+  if [ "$?" -ne "0" ]
   then
     FOUND_ISSUE=-1
   fi

+ 6 - 4
tools/githooks/commit-msg

@@ -2,17 +2,19 @@
 
 INPUT_FILE=$1
 START_LINE=${2:-`head -n1 $INPUT_FILE`}
-PATTERN="^.+{0,71}[^.]$"
+MAX=71
+PATTERN="^.{0,$MAX}$"
 
 if ! [[ "$START_LINE" =~ $PATTERN ]]; then
   echo "'$START_LINE' is not a valid commit message, please see for examples:"
   echo ""
-  echo "  50 characters max recommended, 72 is the hard limit"
+  echo "  50 characters lenght recommended, $MAX max"
   echo ""
   echo "  [hive] Add numExecutors options"
   echo "  [hive] Add numExecutors options (#1000)"
-  echo "  HUE-9999 [hive] Use 26000 as default for thrift-over-http"
+  echo "  GH-1000 [hive] Add numExecutors options"
+  echo ""
+  echo "  Examples of labels: [hive], [impala], [ui], [docs], [api]..."
   echo ""
-  echo "  Examples of labels: [hive], [impala], [phoenix], [ui], [k8s], [docs], [api]..."
   exit 1
 fi