diff --git a/src/main/scala/util/JGitUtil.scala b/src/main/scala/util/JGitUtil.scala index 669330e..07ddc66 100644 --- a/src/main/scala/util/JGitUtil.scala +++ b/src/main/scala/util/JGitUtil.scala @@ -49,10 +49,10 @@ * * @param id the commit id * @param time the commit time - * @param committer the commiter name + * @param committer the committer name * @param shortMessage the short message * @param fullMessage the full message - * @param parents the list of parent commid id + * @param parents the list of parent commit id */ case class CommitInfo(id: String, time: Date, committer: String, shortMessage: String, fullMessage: String, parents: List[String]){ @@ -60,16 +60,26 @@ rev.getName, rev.getCommitterIdent.getWhen, rev.getCommitterIdent.getName, rev.getShortMessage, rev.getFullMessage, rev.getParents().map(_.name).toList) - val description = { - if(shortMessage == fullMessage){ - None + val summary = { + val i = fullMessage.trim.indexOf("\n") + val firstLine = if(i >= 0){ + fullMessage.trim.substring(0, i).trim } else { - val i = fullMessage.trim.indexOf("\n") - if(i >= 0){ - Some(fullMessage.trim.substring(i).trim) - } else { - None - } + fullMessage + } + if(firstLine.length > shortMessage.length){ + shortMessage + } else { + firstLine + } + } + + val description = { + val i = fullMessage.trim.indexOf("\n") + if(i >= 0){ + Some(fullMessage.trim.substring(i).trim) + } else { + None } } diff --git a/src/main/scala/view/helpers.scala b/src/main/scala/view/helpers.scala index 9af5c36..42e697c 100644 --- a/src/main/scala/view/helpers.scala +++ b/src/main/scala/view/helpers.scala @@ -36,7 +36,7 @@ // convert issue id to link .replaceAll("(^|\\W)#([0-9]+)(\\W|$)", "$1#$2$3".format(context.path, repository.owner, repository.name)) // convert commit id to link - .replaceAll("(^|\\W)([a-f0-9]{40})(\\W|$)", "$1$2$3").format(context.path, repository.owner, repository.name)) + .replaceAll("(^|\\W)([a-f0-9]{40})(\\W|$)", "$1$2$3").format(context.path, repository.owner, repository.name)) } diff --git a/src/main/twirl/repo/blob.scala.html b/src/main/twirl/repo/blob.scala.html index 0d4a8cc..1d1c8ae 100644 --- a/src/main/twirl/repo/blob.scala.html +++ b/src/main/twirl/repo/blob.scala.html @@ -21,7 +21,7 @@
@helpers.link(commit.description.get, repository)} diff --git a/src/main/twirl/repo/commits.scala.html b/src/main/twirl/repo/commits.scala.html index 7828579..ec22d22 100644 --- a/src/main/twirl/repo/commits.scala.html +++ b/src/main/twirl/repo/commits.scala.html @@ -30,7 +30,7 @@