Changelog: invert commit order and, if only one tag exists, use all commits before it

This commit is contained in:
Johannes Frohnmeyer 2022-01-04 10:14:56 +00:00
parent 325d9d5434
commit 4f82158528
1 changed files with 7 additions and 5 deletions

View File

@ -94,11 +94,13 @@ if (grgit != null) {
ext.currentType = VersionType.ALPHA
break
}
if (tagList.size() >= 2) {
changelogStr += "Commits in " + ext.currentType.toString().toLowerCase() + " " + ext.currentVer + ":\n"
for (def commit : grgit.log{range(tagList.get(1).fullName, tagList.get(0).fullName)}) {
changelogStr += "- " + commit.shortMessage + "\n"
}
def commits = new ArrayList<>(tagList.size() >= 2
? grgit.log{range(tagList.get(1).fullName, tagList.get(0).fullName)}
: grgit.log(includes: [grgit.tag.list().get(0).fullName]))
Collections.reverse(commits)
changelogStr += "Commits in " + ext.currentType.toString().toLowerCase() + " " + ext.currentVer + ":\n"
for (def commit : commits) {
changelogStr += "- " + commit.shortMessage + "\n"
}
}
}