diff --git a/convention/src/main/kotlin/io/gitlab/jfronny/scripts/JGitExt.kt b/convention/src/main/kotlin/io/gitlab/jfronny/scripts/JGitExt.kt index d1f1702..96518ab 100644 --- a/convention/src/main/kotlin/io/gitlab/jfronny/scripts/JGitExt.kt +++ b/convention/src/main/kotlin/io/gitlab/jfronny/scripts/JGitExt.kt @@ -47,7 +47,7 @@ fun RevTag.resolve(commit: Commit): Tag { return Tag( id, this, - name, + tagName, commit, Person(ident, ident.name, ident.emailAddress), fullMessage.nullable, @@ -61,7 +61,7 @@ fun RevTag.resolve(commit: Commit): Tag { fun RevCommit.resolve(repo: Repository): Commit = Commit( this, - ObjectId.toString(this), + id, try { repo.newObjectReader().use { reader -> reader.abbreviate(this).name() } } catch (e: Exception) { @@ -81,9 +81,9 @@ fun RevCommit.resolve(repo: Repository): Commit = Commit( private val String?.nullable get() = if (this == null || this == "") null else this -data class Tag(val id: ObjectId, val original: RevTag?, val fullName: String, val commit: Commit?, val tagger: Person?, val fullMessage: String?, val shortMessage: String?, val dateTime: ZonedDateTime?) { - val name: String - get() = Repository.shortenRefName(fullName) +data class Tag(val id: ObjectId, val original: RevTag?, val fullName: String, val commit: Commit, val tagger: Person, val fullMessage: String?, val shortMessage: String?, val dateTime: ZonedDateTime?) { + val name: String get() = Repository.shortenRefName(fullName) + val peeledId: ObjectId get() = commit.original.id } -data class Commit(val original: RevCommit, val id: String, val abbreviatedId: String?, val committer: Person, val author: Person, val dateTime: ZonedDateTime, val fullMessage: String, val shortMessage: String, val parentIds: List) +data class Commit(val original: RevCommit, val id: ObjectId, val abbreviatedId: String?, val committer: Person, val author: Person, val dateTime: ZonedDateTime, val fullMessage: String, val shortMessage: String, val parentIds: List) data class Person(val original: PersonIdent, val name: String, val emailAddress: String) \ No newline at end of file diff --git a/convention/src/main/kotlin/jf.autoversion.gradle.kts b/convention/src/main/kotlin/jf.autoversion.gradle.kts index c2123ac..8fa0a9e 100644 --- a/convention/src/main/kotlin/jf.autoversion.gradle.kts +++ b/convention/src/main/kotlin/jf.autoversion.gradle.kts @@ -24,12 +24,12 @@ if (File(projectDir, ".git").exists()) { if (vt != null) versionS = versionS.substring(1) if (isRelease) { changelog += "Commits in ${versionType.displayName} $versionS:\n" - changelog += git.log(if (tags.size >= 2) tags[1].id else null, tags[0].id) + changelog += git.log(if (tags.size >= 2) tags[1].peeledId else null, tags[0].peeledId) .reversed() .joinToString("\n") { "- ${it.shortMessage}" } } else { changelog += "Commits after ${versionType.displayName} $versionS:\n" - changelog += git.log(tags[0].id, git.repository.resolve("HEAD")) + changelog += git.log(tags[0].peeledId, git.repository.resolve("HEAD")) .reversed() .joinToString("\n") { "- ${it.shortMessage}" } }