mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-07 14:05:52 +01:00
Display the first line of commit message on the file list
This commit is contained in:
@@ -76,11 +76,7 @@ object JGitUtil {
|
|||||||
rev.getFullMessage,
|
rev.getFullMessage,
|
||||||
rev.getParents().map(_.name).toList)
|
rev.getParents().map(_.name).toList)
|
||||||
|
|
||||||
val summary = defining(fullMessage.trim.indexOf("\n")){ i =>
|
val summary = getSummaryMessage(fullMessage, shortMessage)
|
||||||
defining(if(i >= 0) fullMessage.trim.substring(0, i).trim else fullMessage){ firstLine =>
|
|
||||||
if(firstLine.length > shortMessage.length) shortMessage else firstLine
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val description = defining(fullMessage.trim.indexOf("\n")){ i =>
|
val description = defining(fullMessage.trim.indexOf("\n")){ i =>
|
||||||
if(i >= 0){
|
if(i >= 0){
|
||||||
@@ -220,16 +216,18 @@ object JGitUtil {
|
|||||||
|
|
||||||
val commits = getLatestCommitFromPaths(git, list.toList.map(_._3), revision)
|
val commits = getLatestCommitFromPaths(git, list.toList.map(_._3), revision)
|
||||||
list.map { case (objectId, fileMode, path, name, linkUrl) =>
|
list.map { case (objectId, fileMode, path, name, linkUrl) =>
|
||||||
|
defining(commits(path)){ commit =>
|
||||||
FileInfo(
|
FileInfo(
|
||||||
objectId,
|
objectId,
|
||||||
fileMode == FileMode.TREE || fileMode == FileMode.GITLINK,
|
fileMode == FileMode.TREE || fileMode == FileMode.GITLINK,
|
||||||
name,
|
name,
|
||||||
commits(path).getCommitterIdent.getWhen,
|
commit.getCommitterIdent.getWhen,
|
||||||
commits(path).getShortMessage,
|
getSummaryMessage(commit.getFullMessage, commit.getShortMessage),
|
||||||
commits(path).getName,
|
commit.getName,
|
||||||
commits(path).getCommitterIdent.getName,
|
commit.getCommitterIdent.getName,
|
||||||
commits(path).getCommitterIdent.getEmailAddress,
|
commit.getCommitterIdent.getEmailAddress,
|
||||||
linkUrl)
|
linkUrl)
|
||||||
|
}
|
||||||
}.sortWith { (file1, file2) =>
|
}.sortWith { (file1, file2) =>
|
||||||
(file1.isDirectory, file2.isDirectory) match {
|
(file1.isDirectory, file2.isDirectory) match {
|
||||||
case (true , false) => true
|
case (true , false) => true
|
||||||
@@ -239,6 +237,17 @@ object JGitUtil {
|
|||||||
}.toList
|
}.toList
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the first line of the commit message.
|
||||||
|
*/
|
||||||
|
private def getSummaryMessage(fullMessage: String, shortMessage: String): String = {
|
||||||
|
defining(fullMessage.trim.indexOf("\n")){ i =>
|
||||||
|
defining(if(i >= 0) fullMessage.trim.substring(0, i).trim else fullMessage){ firstLine =>
|
||||||
|
if(firstLine.length > shortMessage.length) shortMessage else firstLine
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the commit list of the specified branch.
|
* Returns the commit list of the specified branch.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user