mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-10-30 18:15:59 +01:00
Fix lint and typos
This commit is contained in:
4
.github/ISSUE_TEMPLATE.md
vendored
4
.github/ISSUE_TEMPLATE.md
vendored
@@ -1,4 +1,4 @@
|
|||||||
### Before submitting an issue to Gitbucket I have first:
|
### Before submitting an issue to GitBucket I have first:
|
||||||
|
|
||||||
- [] read the [contribution guidelines](https://github.com/gitbucket/gitbucket/blob/master/.github/CONTRIBUTING.md)
|
- [] read the [contribution guidelines](https://github.com/gitbucket/gitbucket/blob/master/.github/CONTRIBUTING.md)
|
||||||
- [] searched for similar already existing issue
|
- [] searched for similar already existing issue
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
## Issue
|
## Issue
|
||||||
**Impacted version**: xxxx
|
**Impacted version**: xxxx
|
||||||
|
|
||||||
**Deployment mode**: *explain here how you use gitbucket : standalone app, under webcontainer (which one), with an http frontend (nginx, httpd, ...)*
|
**Deployment mode**: *explain here how you use GitBucket : standalone app, under webcontainer (which one), with an http frontend (nginx, httpd, ...)*
|
||||||
|
|
||||||
**Problem description**:
|
**Problem description**:
|
||||||
- *be as explicit has you can*
|
- *be as explicit has you can*
|
||||||
|
|||||||
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,4 +1,4 @@
|
|||||||
### Before submitting a pull-request to Gitbucket I have first:
|
### Before submitting a pull-request to GitBucket I have first:
|
||||||
|
|
||||||
- [] read the [contribution guidelines](https://github.com/gitbucket/gitbucket/blob/master/.github/CONTRIBUTING.md)
|
- [] read the [contribution guidelines](https://github.com/gitbucket/gitbucket/blob/master/.github/CONTRIBUTING.md)
|
||||||
- [] rebased my branch over master
|
- [] rebased my branch over master
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ GitBucket has a plug-in system that allows extra functionality. Officially the f
|
|||||||
- [gitbucket-pages-plugin](https://github.com/gitbucket/gitbucket-pages-plugin)
|
- [gitbucket-pages-plugin](https://github.com/gitbucket/gitbucket-pages-plugin)
|
||||||
- [gitbucket-notifications-plugin](https://github.com/gitbucket/gitbucket-notifications-plugin)
|
- [gitbucket-notifications-plugin](https://github.com/gitbucket/gitbucket-notifications-plugin)
|
||||||
|
|
||||||
You can find more plugins made by the community at [GitBucket community plugins](http://gitbucket-plugins.github.io/).
|
You can find more plugins made by the community at [GitBucket community plugins](https://gitbucket-plugins.github.io/).
|
||||||
|
|
||||||
Support
|
Support
|
||||||
--------
|
--------
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
JRebel integration (optional)
|
JRebel integration (optional)
|
||||||
=============================
|
=============================
|
||||||
|
|
||||||
[JRebel](http://zeroturnaround.com/software/jrebel/) is a JVM plugin that makes developing web apps much faster.
|
[JRebel](https://zeroturnaround.com/software/jrebel/) is a JVM plugin that makes developing web apps much faster.
|
||||||
JRebel is generally able to eliminate the need for the following slow "app restart" in sbt following a code change:
|
JRebel is generally able to eliminate the need for the following slow "app restart" in sbt following a code change:
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -22,12 +22,12 @@ Sign up for a [usage plan](https://my.jrebel.com/). You will need to create an a
|
|||||||
|
|
||||||
## 2. Download JRebel
|
## 2. Download JRebel
|
||||||
|
|
||||||
Download the most recent ["nosetup" JRebel zip](http://zeroturnaround.com/software/jrebel/download/prev-releases/).
|
Download the most recent ["nosetup" JRebel zip](https://zeroturnaround.com/software/jrebel/download/prev-releases/).
|
||||||
Next, unzip the downloaded file.
|
Next, unzip the downloaded file.
|
||||||
|
|
||||||
## 3. Activate
|
## 3. Activate
|
||||||
|
|
||||||
Follow the [instructions on the JRebel website](http://zeroturnaround.com/software/jrebel/download/prev-releases/) to activate your downloaded JRebel.
|
Follow the [instructions on the JRebel website](https://zeroturnaround.com/software/jrebel/download/prev-releases/) to activate your downloaded JRebel.
|
||||||
|
|
||||||
You can use the default settings for all the configurations.
|
You can use the default settings for all the configurations.
|
||||||
|
|
||||||
|
|||||||
@@ -381,7 +381,7 @@ trait ApiControllerBase extends ControllerBase {
|
|||||||
get("/api/v3/repos/:owner/:repository/issues/:id/comments")(referrersOnly { repository =>
|
get("/api/v3/repos/:owner/:repository/issues/:id/comments")(referrersOnly { repository =>
|
||||||
(for{
|
(for{
|
||||||
issueId <- params("id").toIntOpt
|
issueId <- params("id").toIntOpt
|
||||||
comments = getCommentsForApi(repository.owner, repository.name, issueId.toInt)
|
comments = getCommentsForApi(repository.owner, repository.name, issueId)
|
||||||
} yield {
|
} yield {
|
||||||
JsonFormat(comments.map{ case (issueComment, user, issue) => ApiComment(issueComment, RepositoryName(repository), issueId, ApiUser(user), issue.isPullRequest) })
|
JsonFormat(comments.map{ case (issueComment, user, issue) => ApiComment(issueComment, RepositoryName(repository), issueId, ApiUser(user), issue.isPullRequest) })
|
||||||
}) getOrElse NotFound()
|
}) getOrElse NotFound()
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ abstract class ControllerBase extends ScalatraFilter
|
|||||||
override def validate(name: String, value: String, params: Map[String, String], messages: Messages): Seq[(String, String)] =
|
override def validate(name: String, value: String, params: Map[String, String], messages: Messages): Seq[(String, String)] =
|
||||||
valueType.validate(name, trim(value), params, messages)
|
valueType.validate(name, trim(value), params, messages)
|
||||||
|
|
||||||
private def trim(value: String): String = if(value == null) null else value.replaceAll("\r\n", "").trim
|
private def trim(value: String): String = if(value == null) null else value.replace("\r\n", "").trim
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
|
|
||||||
post("/:owner/:repository/upload", uploadForm)(writableUsersOnly { (form, repository) =>
|
post("/:owner/:repository/upload", uploadForm)(writableUsersOnly { (form, repository) =>
|
||||||
val files = form.uploadFiles.split("\n").map { line =>
|
val files = form.uploadFiles.split("\n").map { line =>
|
||||||
val i = line.indexOf(":")
|
val i = line.indexOf(':')
|
||||||
CommitFile(line.substring(0, i).trim, line.substring(i + 1).trim)
|
CommitFile(line.substring(0, i).trim, line.substring(i + 1).trim)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,7 +222,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
branch = form.branch,
|
branch = form.branch,
|
||||||
path = form.path,
|
path = form.path,
|
||||||
files = files,
|
files = files,
|
||||||
message = form.message.getOrElse(s"Add files via upload")
|
message = form.message.getOrElse("Add files via upload")
|
||||||
)
|
)
|
||||||
|
|
||||||
if(form.path.length == 0){
|
if(form.path.length == 0){
|
||||||
@@ -630,8 +630,8 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
case class UploadFiles(branch: String, path: String, fileIds : Map[String,String], message: String) {
|
case class UploadFiles(branch: String, path: String, fileIds: Map[String,String], message: String) {
|
||||||
lazy val isValid: Boolean = fileIds.size > 0
|
lazy val isValid: Boolean = fileIds.nonEmpty
|
||||||
}
|
}
|
||||||
|
|
||||||
case class CommitFile(id: String, name: String)
|
case class CommitFile(id: String, name: String)
|
||||||
|
|||||||
@@ -503,14 +503,14 @@ object IssuesService {
|
|||||||
).flatten ++
|
).flatten ++
|
||||||
labels.map(label => s"label:${label}") ++
|
labels.map(label => s"label:${label}") ++
|
||||||
List(
|
List(
|
||||||
milestone.map { _ match {
|
milestone.map {
|
||||||
case Some(x) => s"milestone:${x}"
|
case Some(x) => s"milestone:${x}"
|
||||||
case None => "no:milestone"
|
case None => "no:milestone"
|
||||||
}},
|
},
|
||||||
priority.map { _ match {
|
priority.map {
|
||||||
case Some(x) => s"priority:${x}"
|
case Some(x) => s"priority:${x}"
|
||||||
case None => "no:priority"
|
case None => "no:priority"
|
||||||
}},
|
},
|
||||||
(sort, direction) match {
|
(sort, direction) match {
|
||||||
case ("created" , "desc") => None
|
case ("created" , "desc") => None
|
||||||
case ("created" , "asc" ) => Some("sort:created-asc")
|
case ("created" , "asc" ) => Some("sort:created-asc")
|
||||||
|
|||||||
@@ -18,10 +18,11 @@ trait ProtectedBranchService {
|
|||||||
.filter(_._1.byPrimaryKey(owner, repository, branch))
|
.filter(_._1.byPrimaryKey(owner, repository, branch))
|
||||||
.list
|
.list
|
||||||
.groupBy(_._1)
|
.groupBy(_._1)
|
||||||
|
.headOption
|
||||||
.map { p => p._1 -> p._2.flatMap(_._2) }
|
.map { p => p._1 -> p._2.flatMap(_._2) }
|
||||||
.map { case (t1, contexts) =>
|
.map { case (t1, contexts) =>
|
||||||
new ProtectedBranchInfo(t1.userName, t1.repositoryName, true, contexts, t1.statusCheckAdmin)
|
new ProtectedBranchInfo(t1.userName, t1.repositoryName, true, contexts, t1.statusCheckAdmin)
|
||||||
}.headOption
|
}
|
||||||
|
|
||||||
def getProtectedBranchInfo(owner: String, repository: String, branch: String)(implicit session: Session): ProtectedBranchInfo =
|
def getProtectedBranchInfo(owner: String, repository: String, branch: String)(implicit session: Session): ProtectedBranchInfo =
|
||||||
getProtectedBranchInfoOpt(owner, repository, branch).getOrElse(ProtectedBranchInfo.disabled(owner, repository))
|
getProtectedBranchInfoOpt(owner, repository, branch).getOrElse(ProtectedBranchInfo.disabled(owner, repository))
|
||||||
|
|||||||
@@ -94,9 +94,9 @@ trait PullRequestService { self: IssuesService with CommitsService =>
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* for repository viewer.
|
* for repository viewer.
|
||||||
* 1. find pull request from from `branch` to othre branch on same repository
|
* 1. find pull request from `branch` to other branch on same repository
|
||||||
* 1. return if exists pull request to `defaultBranch`
|
* 1. return if exists pull request to `defaultBranch`
|
||||||
* 2. return if exists pull request to othre branch
|
* 2. return if exists pull request to other branch
|
||||||
* 2. return None
|
* 2. return None
|
||||||
*/
|
*/
|
||||||
def getPullRequestFromBranch(userName: String, repositoryName: String, branch: String, defaultBranch: String)
|
def getPullRequestFromBranch(userName: String, repositoryName: String, branch: String, defaultBranch: String)
|
||||||
@@ -256,7 +256,7 @@ object PullRequestService {
|
|||||||
val statuses: List[CommitStatus] =
|
val statuses: List[CommitStatus] =
|
||||||
commitStatues ++ (branchProtection.contexts.toSet -- commitStatues.map(_.context).toSet).map(CommitStatus.pending(branchProtection.owner, branchProtection.repository, _))
|
commitStatues ++ (branchProtection.contexts.toSet -- commitStatues.map(_.context).toSet).map(CommitStatus.pending(branchProtection.owner, branchProtection.repository, _))
|
||||||
val hasRequiredStatusProblem = needStatusCheck && branchProtection.contexts.exists(context => statuses.find(_.context == context).map(_.state) != Some(CommitState.SUCCESS))
|
val hasRequiredStatusProblem = needStatusCheck && branchProtection.contexts.exists(context => statuses.find(_.context == context).map(_.state) != Some(CommitState.SUCCESS))
|
||||||
val hasProblem = hasRequiredStatusProblem || hasConflict || (!statuses.isEmpty && CommitState.combine(statuses.map(_.state).toSet) != CommitState.SUCCESS)
|
val hasProblem = hasRequiredStatusProblem || hasConflict || (statuses.nonEmpty && CommitState.combine(statuses.map(_.state).toSet) != CommitState.SUCCESS)
|
||||||
val canUpdate = branchIsOutOfDate && !hasConflict
|
val canUpdate = branchIsOutOfDate && !hasConflict
|
||||||
val canMerge = hasMergePermission && !hasConflict && !hasRequiredStatusProblem
|
val canMerge = hasMergePermission && !hasConflict && !hasRequiredStatusProblem
|
||||||
lazy val commitStateSummary:(CommitState, String) = {
|
lazy val commitStateSummary:(CommitState, String) = {
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ trait RepositorySearchService { self: IssuesService =>
|
|||||||
files.map { case (path, text) =>
|
files.map { case (path, text) =>
|
||||||
val (highlightText, lineNumber) = getHighlightText(text, query)
|
val (highlightText, lineNumber) = getHighlightText(text, query)
|
||||||
FileSearchResult(
|
FileSearchResult(
|
||||||
path.replaceFirst("\\.md$", ""),
|
path.stripSuffix(".md"),
|
||||||
commits(path).getCommitterIdent.getWhen,
|
commits(path).getCommitterIdent.getWhen,
|
||||||
highlightText,
|
highlightText,
|
||||||
lineNumber)
|
lineNumber)
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ trait RepositoryService { self: AccountService =>
|
|||||||
repositoryName = newRepositoryName
|
repositoryName = newRepositoryName
|
||||||
)) :_*)
|
)) :_*)
|
||||||
|
|
||||||
// TODO Drop transfered owner from collaborators?
|
// TODO Drop transferred owner from collaborators?
|
||||||
Collaborators.insertAll(collaborators.map(_.copy(userName = newUserName, repositoryName = newRepositoryName)) :_*)
|
Collaborators.insertAll(collaborators.map(_.copy(userName = newUserName, repositoryName = newRepositoryName)) :_*)
|
||||||
|
|
||||||
// Update activity messages
|
// Update activity messages
|
||||||
|
|||||||
@@ -367,9 +367,9 @@ object WebHookService {
|
|||||||
repository: ApiRepository
|
repository: ApiRepository
|
||||||
) extends FieldSerializable with WebHookPayload {
|
) extends FieldSerializable with WebHookPayload {
|
||||||
val compare = commits.size match {
|
val compare = commits.size match {
|
||||||
case 0 => ApiPath(s"/${repository.full_name}") // maybe test hook on un-initalied repository
|
case 0 => ApiPath(s"/${repository.full_name}") // maybe test hook on un-initialized repository
|
||||||
case 1 => ApiPath(s"/${repository.full_name}/commit/${after}")
|
case 1 => ApiPath(s"/${repository.full_name}/commit/${after}")
|
||||||
case _ if before.filterNot(_=='0').isEmpty => ApiPath(s"/${repository.full_name}/compare/${commits.head.id}^...${after}")
|
case _ if before.forall(_=='0') => ApiPath(s"/${repository.full_name}/compare/${commits.head.id}^...${after}")
|
||||||
case _ => ApiPath(s"/${repository.full_name}/compare/${before}...${after}")
|
case _ => ApiPath(s"/${repository.full_name}/compare/${before}...${after}")
|
||||||
}
|
}
|
||||||
val head_commit = commits.lastOption
|
val head_commit = commits.lastOption
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ trait WikiService {
|
|||||||
builder.finish()
|
builder.finish()
|
||||||
val newHeadId = JGitUtil.createNewCommit(git, inserter, headId, builder.getDirCache.writeTree(inserter),
|
val newHeadId = JGitUtil.createNewCommit(git, inserter, headId, builder.getDirCache.writeTree(inserter),
|
||||||
Constants.HEAD, committer.fullName, committer.mailAddress,
|
Constants.HEAD, committer.fullName, committer.mailAddress,
|
||||||
if(message.trim.length == 0) {
|
if(message.trim.isEmpty) {
|
||||||
if(removed){
|
if(removed){
|
||||||
s"Rename ${currentPageName} to ${newPageName}"
|
s"Rename ${currentPageName} to ${newPageName}"
|
||||||
} else if(created){
|
} else if(created){
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ class GitAuthenticationFilter extends Filter with RepositoryService with Account
|
|||||||
val action = request.paths match {
|
val action = request.paths match {
|
||||||
case Array(_, repositoryOwner, repositoryName, _*) =>
|
case Array(_, repositoryOwner, repositoryName, _*) =>
|
||||||
Database() withSession { implicit session =>
|
Database() withSession { implicit session =>
|
||||||
getRepository(repositoryOwner, repositoryName.replaceFirst("\\.wiki\\.git$|\\.git$", "")) match {
|
getRepository(repositoryOwner, repositoryName.replaceFirst("(\\.wiki)?\\.git$", "")) match {
|
||||||
case Some(repository) => {
|
case Some(repository) => {
|
||||||
val execute = if (!isUpdating && !repository.repository.isPrivate && settings.allowAnonymousAccess) {
|
val execute = if (!isUpdating && !repository.repository.isPrivate && settings.allowAnonymousAccess) {
|
||||||
// Authentication is not required
|
// Authentication is not required
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ class GitBucketReceivePackFactory extends ReceivePackFactory[HttpServletRequest]
|
|||||||
|
|
||||||
if(repository.endsWith(".wiki")){
|
if(repository.endsWith(".wiki")){
|
||||||
defining(request) { implicit r =>
|
defining(request) { implicit r =>
|
||||||
receivePack.setPostReceiveHook(new WikiCommitHook(owner, repository.replaceFirst("\\.wiki$", ""), pusher, baseUrl))
|
receivePack.setPostReceiveHook(new WikiCommitHook(owner, repository.stripSuffix(".wiki"), pusher, baseUrl))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class PluginAssetsServlet extends HttpServlet {
|
|||||||
.find { case (prefix, _, _) => path.startsWith("/plugin-assets" + prefix) }
|
.find { case (prefix, _, _) => path.startsWith("/plugin-assets" + prefix) }
|
||||||
.flatMap { case (prefix, resourcePath, classLoader) =>
|
.flatMap { case (prefix, resourcePath, classLoader) =>
|
||||||
val resourceName = path.substring(("/plugin-assets" + prefix).length)
|
val resourceName = path.substring(("/plugin-assets" + prefix).length)
|
||||||
Option(classLoader.getResourceAsStream(resourcePath.replaceFirst("^/", "") + resourceName))
|
Option(classLoader.getResourceAsStream(resourcePath.stripPrefix("/") + resourceName))
|
||||||
}
|
}
|
||||||
.map { in =>
|
.map { in =>
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import javax.servlet.{ServletContextEvent, ServletContextListener}
|
|||||||
|
|
||||||
import gitbucket.core.service.SystemSettingsService
|
import gitbucket.core.service.SystemSettingsService
|
||||||
import gitbucket.core.service.SystemSettingsService.SshAddress
|
import gitbucket.core.service.SystemSettingsService.SshAddress
|
||||||
import gitbucket.core.util.{Directory}
|
import gitbucket.core.util.Directory
|
||||||
import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider
|
import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ object JDBCUtil {
|
|||||||
var stringLiteral = false
|
var stringLiteral = false
|
||||||
|
|
||||||
while({ length = in.read(bytes); length != -1 }){
|
while({ length = in.read(bytes); length != -1 }){
|
||||||
for(i <- 0 to length - 1){
|
for(i <- 0 until length){
|
||||||
val c = bytes(i)
|
val c = bytes(i)
|
||||||
if(c == '\''){
|
if(c == '\''){
|
||||||
stringLiteral = !stringLiteral
|
stringLiteral = !stringLiteral
|
||||||
@@ -146,14 +146,12 @@ object JDBCUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val columnValues = values.map { value =>
|
val columnValues = values.map {
|
||||||
value match {
|
|
||||||
case x: String => "'" + x.replace("'", "''") + "'"
|
case x: String => "'" + x.replace("'", "''") + "'"
|
||||||
case x: Timestamp => "'" + dateFormat.format(x) + "'"
|
case x: Timestamp => "'" + dateFormat.format(x) + "'"
|
||||||
case null => "NULL"
|
case null => "NULL"
|
||||||
case x => x
|
case x => x
|
||||||
}
|
}
|
||||||
}
|
|
||||||
sb.append(columnValues.mkString(", "))
|
sb.append(columnValues.mkString(", "))
|
||||||
sb.append(");\n")
|
sb.append(");\n")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ object JGitUtil {
|
|||||||
|
|
||||||
val summary = getSummaryMessage(fullMessage, shortMessage)
|
val summary = getSummaryMessage(fullMessage, shortMessage)
|
||||||
|
|
||||||
val description = defining(fullMessage.trim.indexOf("\n")){ i =>
|
val description = defining(fullMessage.trim.indexOf('\n')){ i =>
|
||||||
if(i >= 0){
|
if(i >= 0){
|
||||||
Some(fullMessage.trim.substring(i).trim)
|
Some(fullMessage.trim.substring(i).trim)
|
||||||
} else None
|
} else None
|
||||||
@@ -293,7 +293,7 @@ object JGitUtil {
|
|||||||
@tailrec
|
@tailrec
|
||||||
def findLastCommits(result:List[(ObjectId, FileMode, String, String, Option[String], RevCommit)],
|
def findLastCommits(result:List[(ObjectId, FileMode, String, String, Option[String], RevCommit)],
|
||||||
restList:List[((ObjectId, FileMode, String, String, Option[String]), Map[RevCommit, RevCommit])],
|
restList:List[((ObjectId, FileMode, String, String, Option[String]), Map[RevCommit, RevCommit])],
|
||||||
revIterator:java.util.Iterator[RevCommit]): List[(ObjectId, FileMode, String, String, Option[String], RevCommit)] ={
|
revIterator:java.util.Iterator[RevCommit]): List[(ObjectId, FileMode, String, String, Option[String], RevCommit)] = {
|
||||||
if(restList.isEmpty){
|
if(restList.isEmpty){
|
||||||
result
|
result
|
||||||
} else if(!revIterator.hasNext){ // maybe, revCommit has only 1 log. other case, restList be empty
|
} else if(!revIterator.hasNext){ // maybe, revCommit has only 1 log. other case, restList be empty
|
||||||
@@ -366,7 +366,7 @@ object JGitUtil {
|
|||||||
case (false, true ) => false
|
case (false, true ) => false
|
||||||
case _ => file1.name.compareTo(file2.name) < 0
|
case _ => file1.name.compareTo(file2.name) < 0
|
||||||
}
|
}
|
||||||
}.toList
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,7 +374,7 @@ object JGitUtil {
|
|||||||
* Returns the first line of the commit message.
|
* Returns the first line of the commit message.
|
||||||
*/
|
*/
|
||||||
private def getSummaryMessage(fullMessage: String, shortMessage: String): String = {
|
private def getSummaryMessage(fullMessage: String, shortMessage: String): String = {
|
||||||
defining(fullMessage.trim.indexOf("\n")){ i =>
|
defining(fullMessage.trim.indexOf('\n')){ i =>
|
||||||
defining(if(i >= 0) fullMessage.trim.substring(0, i).trim else fullMessage){ firstLine =>
|
defining(if(i >= 0) fullMessage.trim.substring(0, i).trim else fullMessage){ firstLine =>
|
||||||
if(firstLine.length > shortMessage.length) shortMessage else firstLine
|
if(firstLine.length > shortMessage.length) shortMessage else firstLine
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ object helpers extends AvatarImageProvider with LinkConverter with RequestCache
|
|||||||
repository: RepositoryService.RepositoryInfo,
|
repository: RepositoryService.RepositoryInfo,
|
||||||
enableWikiLink: Boolean, enableRefsLink: Boolean, enableAnchor: Boolean)(implicit context: Context): Html = {
|
enableWikiLink: Boolean, enableRefsLink: Boolean, enableAnchor: Boolean)(implicit context: Context): Html = {
|
||||||
|
|
||||||
val fileName = filePath.reverse.head.toLowerCase
|
val fileName = filePath.last.toLowerCase
|
||||||
val extension = FileUtil.getExtension(fileName)
|
val extension = FileUtil.getExtension(fileName)
|
||||||
val renderer = PluginRegistry().getRenderer(extension)
|
val renderer = PluginRegistry().getRenderer(extension)
|
||||||
renderer.render(RenderRequest(filePath, fileContent, branch, repository, enableWikiLink, enableRefsLink, enableAnchor, context))
|
renderer.render(RenderRequest(filePath, fileContent, branch, repository, enableWikiLink, enableRefsLink, enableAnchor, context))
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
if (document.queryCommandSupported('copy')) {
|
if (document.queryCommandSupported('copy')) {
|
||||||
var title = $('#@copyButtonId').attr('title');
|
var title = $('#@copyButtonId').attr('title');
|
||||||
$('#@copyButtonId').tooltip({
|
$('#@copyButtonId').tooltip({
|
||||||
@* if default container is used then 2 lines tooltip text is displayd because tooptip width is narrow. *@
|
@* if default container is used then 2 lines tooltip text is displayed because tooptip width is narrow. *@
|
||||||
container: 'body'
|
container: 'body'
|
||||||
});
|
});
|
||||||
$('#@copyButtonId').on('click', function() {
|
$('#@copyButtonId').on('click', function() {
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
@import gitbucket.core.view.helpers
|
@import gitbucket.core.view.helpers
|
||||||
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xml:lang="en-US">
|
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xml:lang="en-US">
|
||||||
<id>tag:@context.host,2013:gitbucket</id>
|
<id>tag:@context.host,2013:gitbucket</id>
|
||||||
<title>Gitbucket's activities</title>
|
<title>GitBucket's activities</title>
|
||||||
<link type="application/atom+xml" rel="self" href="@context.baseUrl/activities.atom"/>
|
<link type="application/atom+xml" rel="self" href="@context.baseUrl/activities.atom"/>
|
||||||
<author>
|
<author>
|
||||||
<name>Gitbucket</name>
|
<name>GitBucket</name>
|
||||||
<uri>@context.baseUrl</uri>
|
<uri>@context.baseUrl</uri>
|
||||||
</author>
|
</author>
|
||||||
<updated>@helpers.datetimeRFC3339(if(activities.isEmpty) new java.util.Date else activities.map(_.activityDate).max)</updated>
|
<updated>@helpers.datetimeRFC3339(if(activities.isEmpty) new java.util.Date else activities.map(_.activityDate).max)</updated>
|
||||||
|
|||||||
@@ -71,7 +71,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@if(content.viewType == "text"){
|
@if(content.viewType == "text"){
|
||||||
@defining(helpers.isRenderable(pathList.reverse.head)){ isRenderable =>
|
@defining(helpers.isRenderable(pathList.last)){ isRenderable =>
|
||||||
@if(!isBlame && isRenderable) {
|
@if(!isBlame && isRenderable) {
|
||||||
<div class="box-content-bottom markdown-body" style="padding-left: 20px; padding-right: 20px;">
|
<div class="box-content-bottom markdown-body" style="padding-left: 20px; padding-right: 20px;">
|
||||||
@helpers.renderMarkup(pathList, content.content.get, branch, repository, false, false, true)
|
@helpers.renderMarkup(pathList, content.content.get, branch, repository, false, false, true)
|
||||||
|
|||||||
@@ -175,7 +175,7 @@
|
|||||||
</table>
|
</table>
|
||||||
@readme.map { case(filePath, content) =>
|
@readme.map { case(filePath, content) =>
|
||||||
<div id="readme" class="panel panel-default">
|
<div id="readme" class="panel panel-default">
|
||||||
<div class="panel-heading strong">@filePath.reverse.head</div>
|
<div class="panel-heading strong">@filePath.last</div>
|
||||||
<div class="panel-body markdown-body" style="padding-left: 20px; padding-right: 20px;">@helpers.renderMarkup(filePath, content, branch, repository, false, false, true)</div>
|
<div class="panel-body markdown-body" style="padding-left: 20px; padding-right: 20px;">@helpers.renderMarkup(filePath, content, branch, repository, false, false, true)</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@repository.tags.reverse.map { tag =>
|
@repository.tags.reverseMap { tag =>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="@helpers.url(repository)/tree/@helpers.encodeRefName(tag.name)">@tag.name</a></td>
|
<td><a href="@helpers.url(repository)/tree/@helpers.encodeRefName(tag.name)">@tag.name</a></td>
|
||||||
<td>@gitbucket.core.helper.html.datetimeago(tag.time, false)</td>
|
<td>@gitbucket.core.helper.html.datetimeago(tag.time, false)</td>
|
||||||
|
|||||||
@@ -443,7 +443,7 @@ function string_score(string, word) {
|
|||||||
* @param word {String} search word
|
* @param word {String} search word
|
||||||
* @param strings {Array[String]} search targets
|
* @param strings {Array[String]} search targets
|
||||||
* @param limit {Integer} result limit
|
* @param limit {Integer} result limit
|
||||||
* @return {Array[{score:"float matching score", string:"string target string", matchingPositions:"Array[Interger] matchng positions"}]}
|
* @return {Array[{score:"float matching score", string:"string target string", matchingPositions:"Array[Integer] matching positions"}]}
|
||||||
*/
|
*/
|
||||||
function string_score_sort(word, strings, limit){
|
function string_score_sort(word, strings, limit){
|
||||||
var ret = [], i=0, l = (word==="")?Math.min(strings.length, limit):strings.length;
|
var ret = [], i=0, l = (word==="")?Math.min(strings.length, limit):strings.length;
|
||||||
@@ -466,7 +466,7 @@ function string_score_sort(word, strings, limit){
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* highlight by result.
|
* highlight by result.
|
||||||
* @param score {string:"string target string", matchingPositions:"Array[Interger] matchng positions"}
|
* @param score {string:"string target string", matchingPositions:"Array[Integer] matching positions"}
|
||||||
* @param highlight tag ex: '<b>'
|
* @param highlight tag ex: '<b>'
|
||||||
* @return array of highlighted html elements.
|
* @return array of highlighted html elements.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class MergeServiceSpec extends FunSpec {
|
|||||||
def initRepository(owner:String, name:String): File = {
|
def initRepository(owner:String, name:String): File = {
|
||||||
val dir = createTestRepository(getRepositoryDir(owner, name))
|
val dir = createTestRepository(getRepositoryDir(owner, name))
|
||||||
using(Git.open(dir)){ git =>
|
using(Git.open(dir)){ git =>
|
||||||
createFile(git, s"refs/heads/master", "test.txt", "hoge" )
|
createFile(git, "refs/heads/master", "test.txt", "hoge" )
|
||||||
git.branchCreate().setStartPoint(s"refs/heads/master").setName(s"refs/pull/${issueId}/head").call()
|
git.branchCreate().setStartPoint(s"refs/heads/master").setName(s"refs/pull/${issueId}/head").call()
|
||||||
}
|
}
|
||||||
dir
|
dir
|
||||||
|
|||||||
@@ -11,15 +11,15 @@ class PullRequestServiceSpec extends FunSpec with ServiceSpecBase
|
|||||||
describe("PullRequestService.getPullRequestFromBranch") {
|
describe("PullRequestService.getPullRequestFromBranch") {
|
||||||
it("""should
|
it("""should
|
||||||
|return pull request if exists pull request from `branch` to `defaultBranch` and not closed.
|
|return pull request if exists pull request from `branch` to `defaultBranch` and not closed.
|
||||||
|return pull request if exists pull request from `branch` to othre branch and not closed.
|
|return pull request if exists pull request from `branch` to other branch and not closed.
|
||||||
|return None if all pull request is closed""".stripMargin.trim) { withTestDB { implicit se =>
|
|return None if all pull request is closed""".stripMargin.trim) { withTestDB { implicit se =>
|
||||||
generateNewUserWithDBRepository("user1", "repo1")
|
generateNewUserWithDBRepository("user1", "repo1")
|
||||||
generateNewUserWithDBRepository("user1", "repo2")
|
generateNewUserWithDBRepository("user1", "repo2")
|
||||||
generateNewUserWithDBRepository("user2", "repo1")
|
generateNewUserWithDBRepository("user2", "repo1")
|
||||||
generateNewPullRequest("user1/repo1/master", "user1/repo1/head2") // not target branch
|
generateNewPullRequest("user1/repo1/master", "user1/repo1/head2") // not target branch
|
||||||
generateNewPullRequest("user1/repo1/head1", "user1/repo1/master") // not target branch ( swap from, to )
|
generateNewPullRequest("user1/repo1/head1", "user1/repo1/master") // not target branch ( swap from, to )
|
||||||
generateNewPullRequest("user1/repo1/master", "user2/repo1/head1") // othre user
|
generateNewPullRequest("user1/repo1/master", "user2/repo1/head1") // other user
|
||||||
generateNewPullRequest("user1/repo1/master", "user1/repo2/head1") // othre repository
|
generateNewPullRequest("user1/repo1/master", "user1/repo2/head1") // other repository
|
||||||
val r1 = swap(generateNewPullRequest("user1/repo1/master2", "user1/repo1/head1"))
|
val r1 = swap(generateNewPullRequest("user1/repo1/master2", "user1/repo1/head1"))
|
||||||
val r2 = swap(generateNewPullRequest("user1/repo1/master", "user1/repo1/head1"))
|
val r2 = swap(generateNewPullRequest("user1/repo1/master", "user1/repo1/head1"))
|
||||||
val r3 = swap(generateNewPullRequest("user1/repo1/master4", "user1/repo1/head1"))
|
val r3 = swap(generateNewPullRequest("user1/repo1/master4", "user1/repo1/head1"))
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class HelpersSpec extends FunSpec with MockitoSugar {
|
|||||||
assert(after == """Example Project. <a href="http://example.com">http://example.com</a>""")
|
assert(after == """Example Project. <a href="http://example.com">http://example.com</a>""")
|
||||||
}
|
}
|
||||||
|
|
||||||
it("should convert a mulitple links within text") {
|
it("should convert a multiple links within text") {
|
||||||
val before = "Example Project. http://example.com. (See also https://github.com/)"
|
val before = "Example Project. http://example.com. (See also https://github.com/)"
|
||||||
val after = detectAndRenderLinks(before, repository)
|
val after = detectAndRenderLinks(before, repository)
|
||||||
assert(after == """Example Project. <a href="http://example.com">http://example.com</a>. (See also <a href="https://github.com/">https://github.com/</a>)""")
|
assert(after == """Example Project. <a href="http://example.com">http://example.com</a>. (See also <a href="https://github.com/">https://github.com/</a>)""")
|
||||||
|
|||||||
Reference in New Issue
Block a user