Peel tags
This commit is contained in:
parent
8e9bc17c47
commit
a44ff20a21
|
@ -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<String>)
|
||||
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<String>)
|
||||
data class Person(val original: PersonIdent, val name: String, val emailAddress: String)
|
|
@ -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}" }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue