Nullable git tag messages
This commit is contained in:
parent
81aebec2c6
commit
b545835010
|
@ -33,7 +33,7 @@ fun Ref.resolveTag(repo: Repository): Tag = RevWalk(repo).use { walk ->
|
|||
// Lightweight (unannotated) tag
|
||||
// Copy information from commit
|
||||
val target = walk.parseCommit(objectId).resolve(repo)
|
||||
return Tag(objectId, null, name, target, target.author, target.fullMessage, target.shortMessage, target.dateTime)
|
||||
return Tag(objectId, null, name, target, target.author, null, null, target.dateTime)
|
||||
}
|
||||
walk.parseBody(rev)
|
||||
walk.parseBody(rev.`object`)
|
||||
|
@ -50,8 +50,8 @@ fun RevTag.resolve(commit: Commit): Tag {
|
|||
name,
|
||||
commit,
|
||||
Person(ident, ident.name, ident.emailAddress),
|
||||
fullMessage,
|
||||
shortMessage,
|
||||
fullMessage.nullable,
|
||||
shortMessage.nullable,
|
||||
ZonedDateTime.ofInstant(
|
||||
ident.`when`.toInstant(),
|
||||
ident.timeZone?.toZoneId() ?: ZoneOffset.UTC
|
||||
|
@ -79,6 +79,8 @@ fun RevCommit.resolve(repo: Repository): Commit = Commit(
|
|||
parents.map { ObjectId.toString(it) }
|
||||
)
|
||||
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue