Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
3c5367d2
Unverified
Commit
3c5367d2
authored
Jan 28, 2022
by
Marc Cornellà
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(changelog): don't show changelog with only ignored type commits
parent
b5edb51e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
14 deletions
+20
-14
changelog.sh
tools/changelog.sh
+20
-14
No files found.
tools/changelog.sh
View file @
3c5367d2
...
...
@@ -23,8 +23,7 @@ TYPES=(
test
"Testing"
)
#* Types that will be displayed in their own section,
#* in the order specified here.
#* Types that will be displayed in their own section, in the order specified here.
local
-a
MAIN_TYPES
MAIN_TYPES
=(
feat fix perf docs
)
...
...
@@ -34,7 +33,8 @@ OTHER_TYPES=(refactor style other)
#* Commit types that don't appear in $MAIN_TYPES nor $OTHER_TYPES
#* will not be displayed and will simply be ignored.
local
-a
IGNORED_TYPES
IGNORED_TYPES
=(
${${${
(@k)TYPES
}
:|MAIN_TYPES
}
:|OTHER_TYPES
}
)
############################
# COMMIT PARSING UTILITIES #
...
...
@@ -139,7 +139,7 @@ function parse-commit {
# [BREAKING CHANGE: warning]
# commits holds the commit type
commit
s[
$hash
]=
"
$(
commit:type
"
$subject
"
)
"
type
s[
$hash
]=
"
$(
commit:type
"
$subject
"
)
"
# scopes holds the commit scope
scopes[
$hash
]=
"
$(
commit:scope
"
$subject
"
)
"
# subjects holds the commit subject
...
...
@@ -164,26 +164,32 @@ function parse-commit {
function
display-release
{
# This function uses the following globals: output, version,
#
commit
s (A), subjects (A), scopes (A), breaking (A) and reverts (A).
#
type
s (A), subjects (A), scopes (A), breaking (A) and reverts (A).
#
# - output is the output format to use when formatting (raw|text|md)
# - version is the version in which the commits are made
# -
commit
s, subjects, scopes, breaking, and reverts are associative arrays
# -
type
s, subjects, scopes, breaking, and reverts are associative arrays
# with commit hashes as keys
# Remove commits that were reverted
local hash
rhash
for
hash
rhash
in
${
(kv)reverts
}
;
do
if
((
${
+
commit
s[
$rhash
]
}
))
;
then
if
((
${
+
type
s[
$rhash
]
}
))
;
then
# Remove revert commit
unset
"
commit
s[
$hash
]"
"subjects[
$hash
]"
"scopes[
$hash
]"
"breaking[
$hash
]"
unset
"
type
s[
$hash
]"
"subjects[
$hash
]"
"scopes[
$hash
]"
"breaking[
$hash
]"
# Remove reverted commit
unset
"
commit
s[
$rhash
]"
"subjects[
$rhash
]"
"scopes[
$rhash
]"
"breaking[
$rhash
]"
unset
"
type
s[
$rhash
]"
"subjects[
$rhash
]"
"scopes[
$rhash
]"
"breaking[
$rhash
]"
fi
done
# Remove commits from ignored types unless it has breaking change information
for
hash
in
${
(k)types[(R)
${
(j
:|:
)IGNORED_TYPES
}
]
}
;
do
((
!
${
+breaking[
$hash
]
}
))
||
continue
unset
"types[
$hash
]"
"subjects[
$hash
]"
"scopes[
$hash
]"
done
# If no commits left skip displaying the release
if
((
$#
commit
s
==
0
))
;
then
if
((
$#
type
s
==
0
))
;
then
return
fi
...
...
@@ -313,7 +319,7 @@ function display-release {
local hash type
=
"
$1
"
local
-a
hashes
hashes
=(
${
(k)
commit
s[(R)
$type
]
}
)
hashes
=(
${
(k)
type
s[(R)
$type
]
}
)
# If no commits found of type $type, go to next type
((
$#hashes
!=
0
))
||
return
0
...
...
@@ -330,7 +336,7 @@ function display-release {
# Commits made under types considered other changes
local
-A
changes
changes
=(
${
(kv)
commit
s[(R)
${
(j
:|:
)OTHER_TYPES
}
]
}
)
changes
=(
${
(kv)
type
s[(R)
${
(j
:|:
)OTHER_TYPES
}
]
}
)
# If no commits found under "other" types, don't display anything
((
$#changes
!=
0
))
||
return
0
...
...
@@ -388,7 +394,7 @@ function main {
fi
# Commit classification arrays
local
-A
commit
s subjects scopes breaking reverts
local
-A
type
s subjects scopes breaking reverts
local truncate
=
0
read_commits
=
0
local
version tag
local hash
refs subject body
...
...
@@ -441,7 +447,7 @@ function main {
# Output previous release
display-release
# Reinitialize commit storage
commit
s
=()
type
s
=()
subjects
=()
scopes
=()
breaking
=()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment