浏览代码

fix(changelog): don't parse commits of ignored types

Marc Cornellà 3 年之前
父节点
当前提交
63b7e5767d
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      tools/changelog.sh

+ 6 - 2
tools/changelog.sh

@@ -120,7 +120,7 @@ function parse-commit {
   fi
   fi
 
 
   # Parse commit with hash $1
   # Parse commit with hash $1
-  local hash="$1" subject body warning rhash
+  local hash="$1" subject body type warning rhash
   subject="$(command git show -s --format=%s $hash)"
   subject="$(command git show -s --format=%s $hash)"
   body="$(command git show -s --format=%b $hash)"
   body="$(command git show -s --format=%b $hash)"
 
 
@@ -132,8 +132,12 @@ function parse-commit {
   #  commit body
   #  commit body
   #  [BREAKING CHANGE: warning]
   #  [BREAKING CHANGE: warning]
 
 
+  # if commit type is not going to be displayed, do nothing else
+  type="$(commit:type "$subject")"
+  (( ${MAIN_TYPES[(Ie)$type]} || ${OTHER_TYPES[(Ie)$type]} )) || return
+
   # commits holds the commit type
   # commits holds the commit type
-  commits[$hash]="$(commit:type "$subject")"
+  commits[$hash]="$type"
   # scopes holds the commit scope
   # scopes holds the commit scope
   scopes[$hash]="$(commit:scope "$subject")"
   scopes[$hash]="$(commit:scope "$subject")"
   # subjects holds the commit subject
   # subjects holds the commit subject