From 0a08879d8c8846cebcfb381185d2ee2f902d4ad6 Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Sat, 1 Apr 2017 02:48:40 +0900 Subject: [PATCH 01/52] 4.11 release --- README.md | 7 +++++++ build.sbt | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d3813a86a..b9222ea0a 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,13 @@ Support Release Notes ------------- +### 4.11 - 1 Apr 2017 +- Deploy keys support +- Auto generate avatar images +- Collaborators of the private forked repository are copied from the original repository +- Cache avatar images in the browser +- New extension point to receive events about repository + ### 4.10 - 25 Feb 2017 - Update to Scala 2.12, Scalatra 2.5 and Slick 3.2 - Display file size in the file viewer diff --git a/build.sbt b/build.sbt index caebd90ec..25ee799ad 100644 --- a/build.sbt +++ b/build.sbt @@ -1,6 +1,6 @@ val Organization = "io.github.gitbucket" val Name = "gitbucket" -val GitBucketVersion = "4.10.0" +val GitBucketVersion = "4.11.0" val ScalatraVersion = "2.5.0" val JettyVersion = "9.3.9.v20160517" From 3bb32f11d77bb905b9049f151a4d49b397d4ce7f Mon Sep 17 00:00:00 2001 From: KOUNOIKE Yuusuke Date: Sat, 1 Apr 2017 21:26:32 +0900 Subject: [PATCH 02/52] Fix #1516 send noimage.png when user is not exist or removed. --- .../gitbucket/core/controller/AccountController.scala | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/scala/gitbucket/core/controller/AccountController.scala b/src/main/scala/gitbucket/core/controller/AccountController.scala index 139470232..b72c9a94a 100644 --- a/src/main/scala/gitbucket/core/controller/AccountController.scala +++ b/src/main/scala/gitbucket/core/controller/AccountController.scala @@ -150,20 +150,21 @@ trait AccountControllerBase extends AccountManagementControllerBase { get("/:userName/_avatar"){ val userName = params("userName") + contentType = "image/png" getAccountByUserName(userName).map{ account => response.setDateHeader("Last-Modified", account.updatedDate.getTime) account.image.map{ image => RawData(FileUtil.getMimeType(image), new java.io.File(getUserUploadDir(userName), image)) }.getOrElse{ - contentType = "image/png" (if (account.isGroupAccount) { TextAvatarUtil.textGroupAvatar(account.fullName) } else { TextAvatarUtil.textAvatar(account.fullName) - }).getOrElse(Thread.currentThread.getContextClassLoader.getResourceAsStream("noimage.png")) + }).get } }.getOrElse{ - NotFound() + response.setHeader("Cache-Control", "max-age=3600") + Thread.currentThread.getContextClassLoader.getResourceAsStream("noimage.png") } } From a7920a7dd780657cd20a36b2c2213c373c0ef8f3 Mon Sep 17 00:00:00 2001 From: KOUNOIKE Yuusuke Date: Sat, 1 Apr 2017 19:29:24 +0900 Subject: [PATCH 03/52] When using H2, caution message shows at sign-in. --- src/main/twirl/gitbucket/core/signin.scala.html | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/twirl/gitbucket/core/signin.scala.html b/src/main/twirl/gitbucket/core/signin.scala.html index fa172d851..828388711 100644 --- a/src/main/twirl/gitbucket/core/signin.scala.html +++ b/src/main/twirl/gitbucket/core/signin.scala.html @@ -1,6 +1,7 @@ @(userName: Option[Any] = None, password: Option[Any] = None, error: Option[Any] = None)(implicit context: gitbucket.core.controller.Context) +@import gitbucket.core.util.DatabaseConfig @gitbucket.core.html.main("Sign in"){
@@ -11,6 +12,12 @@ @Html(information)
} + @if(DatabaseConfig.url.startsWith("jdbc:h2:")) { +
+ + H2 database should be used for evaluation purpose only. +
+ } @gitbucket.core.helper.html.error(error) @gitbucket.core.html.signinform(context.settings, userName, password)
From dcd4c55fb927afb124c36b198dc5d404ef941fb0 Mon Sep 17 00:00:00 2001 From: KOUNOIKE Yuusuke Date: Sat, 1 Apr 2017 20:55:36 +0900 Subject: [PATCH 04/52] Add caution message in System settings. --- .../twirl/gitbucket/core/admin/system.scala.html | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/twirl/gitbucket/core/admin/system.scala.html b/src/main/twirl/gitbucket/core/admin/system.scala.html index c78ad6d3a..c06702b32 100644 --- a/src/main/twirl/gitbucket/core/admin/system.scala.html +++ b/src/main/twirl/gitbucket/core/admin/system.scala.html @@ -1,4 +1,5 @@ @(info: Option[Any])(implicit context: gitbucket.core.controller.Context) +@import gitbucket.core.util.DatabaseConfig @gitbucket.core.html.main("System settings"){ @gitbucket.core.admin.html.menu("system"){ @gitbucket.core.helper.html.information(info) @@ -20,7 +21,17 @@ DATABASE_URL - @gitbucket.core.util.DatabaseConfig.url + @if(DatabaseConfig.url.startsWith("jdbc:h2:")) { + +

@gitbucket.core.util.DatabaseConfig.url

+

H2 database should be used for evaluation purpose only.

+

+ Please configure using external database explained here. +

+ + }else{ + @gitbucket.core.util.DatabaseConfig.url + } From d0fa4da45a0802ca18bda24a9017f30b33e770b1 Mon Sep 17 00:00:00 2001 From: KOUNOIKE Yuusuke Date: Sun, 2 Apr 2017 15:11:38 +0900 Subject: [PATCH 05/52] Remove message on sign-in dialog. and change message in System settings. --- src/main/twirl/gitbucket/core/admin/system.scala.html | 2 +- src/main/twirl/gitbucket/core/signin.scala.html | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/main/twirl/gitbucket/core/admin/system.scala.html b/src/main/twirl/gitbucket/core/admin/system.scala.html index c06702b32..46de04c5c 100644 --- a/src/main/twirl/gitbucket/core/admin/system.scala.html +++ b/src/main/twirl/gitbucket/core/admin/system.scala.html @@ -24,7 +24,7 @@ @if(DatabaseConfig.url.startsWith("jdbc:h2:")) {

@gitbucket.core.util.DatabaseConfig.url

-

H2 database should be used for evaluation purpose only.

+

Embedded H2 database should be used for evaluation purpose only.

Please configure using external database explained here.

diff --git a/src/main/twirl/gitbucket/core/signin.scala.html b/src/main/twirl/gitbucket/core/signin.scala.html index 828388711..fa172d851 100644 --- a/src/main/twirl/gitbucket/core/signin.scala.html +++ b/src/main/twirl/gitbucket/core/signin.scala.html @@ -1,7 +1,6 @@ @(userName: Option[Any] = None, password: Option[Any] = None, error: Option[Any] = None)(implicit context: gitbucket.core.controller.Context) -@import gitbucket.core.util.DatabaseConfig @gitbucket.core.html.main("Sign in"){
@@ -12,12 +11,6 @@ @Html(information)
} - @if(DatabaseConfig.url.startsWith("jdbc:h2:")) { -
- - H2 database should be used for evaluation purpose only. -
- } @gitbucket.core.helper.html.error(error) @gitbucket.core.html.signinform(context.settings, userName, password)
From 56a39775e89918f657e559d6b830d5e0156305fc Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Sun, 2 Apr 2017 15:17:21 +0900 Subject: [PATCH 06/52] use "forall" instead of "filterNot().isEmpty" --- src/main/scala/gitbucket/core/api/CreateAStatus.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/scala/gitbucket/core/api/CreateAStatus.scala b/src/main/scala/gitbucket/core/api/CreateAStatus.scala index 3871999ff..f8c087f55 100644 --- a/src/main/scala/gitbucket/core/api/CreateAStatus.scala +++ b/src/main/scala/gitbucket/core/api/CreateAStatus.scala @@ -19,8 +19,8 @@ case class CreateAStatus( def isValid: Boolean = { CommitState.valueOf(state).isDefined && // only http - target_url.filterNot(f => "\\Ahttps?://".r.findPrefixOf(f).isDefined && f.length<255).isEmpty && - context.filterNot(f => f.length<255).isEmpty && - description.filterNot(f => f.length<1000).isEmpty + target_url.forall(f => "\\Ahttps?://".r.findPrefixOf(f).isDefined && f.length < 255) && + context.forall(f => f.length < 255) && + description.forall(f => f.length < 1000) } } From 114c50a354adb7a6b4b7ca5408e17b729cf6cdf4 Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Sun, 2 Apr 2017 15:19:12 +0900 Subject: [PATCH 07/52] use "contains(key)" instead of "exists(_ == key)" --- .../core/controller/RepositoryViewerController.scala | 4 ++-- .../scala/gitbucket/core/service/PullRequestService.scala | 2 +- src/main/scala/gitbucket/core/ssh/GitCommand.scala | 4 ++-- .../scala/gitbucket/core/ssh/PublicKeyAuthenticator.scala | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala b/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala index 1b4ecc984..896ec8219 100644 --- a/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala +++ b/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala @@ -232,7 +232,7 @@ trait RepositoryViewerControllerBase extends ControllerBase { oldFileName = form.oldFileName, content = appendNewLine(convertLineSeparator(form.content, form.lineSeparator), form.lineSeparator), charset = form.charset, - message = if(form.oldFileName.exists(_ == form.newFileName)){ + message = if(form.oldFileName.contains(form.newFileName)){ form.message.getOrElse(s"Update ${form.newFileName}") } else { form.message.getOrElse(s"Rename ${form.oldFileName.get} to ${form.newFileName}") @@ -614,7 +614,7 @@ trait RepositoryViewerControllerBase extends ControllerBase { val permission = JGitUtil.processTree(git, headTip){ (path, tree) => // Add all entries except the editing file - if(!newPath.exists(_ == path) && !oldPath.exists(_ == path)){ + if(!newPath.contains(path) && !oldPath.contains(path)){ builder.add(JGitUtil.createDirCacheEntry(path, tree.getEntryFileMode, tree.getEntryObjectId)) } // Retrieve permission if file exists to keep it diff --git a/src/main/scala/gitbucket/core/service/PullRequestService.scala b/src/main/scala/gitbucket/core/service/PullRequestService.scala index 3807e5528..03f2e6ed7 100644 --- a/src/main/scala/gitbucket/core/service/PullRequestService.scala +++ b/src/main/scala/gitbucket/core/service/PullRequestService.scala @@ -265,7 +265,7 @@ object PullRequestService { val summary = stateMap.map{ case (keyState, states) => states.size+" "+keyState.name }.mkString(", ") state -> summary } - lazy val statusesAndRequired:List[(CommitStatus, Boolean)] = statuses.map{ s => s -> branchProtection.contexts.exists(_==s.context) } + lazy val statusesAndRequired:List[(CommitStatus, Boolean)] = statuses.map{ s => s -> branchProtection.contexts.contains(s.context) } lazy val isAllSuccess = commitStateSummary._1==CommitState.SUCCESS } } diff --git a/src/main/scala/gitbucket/core/ssh/GitCommand.scala b/src/main/scala/gitbucket/core/ssh/GitCommand.scala index 946180389..0629c14ce 100644 --- a/src/main/scala/gitbucket/core/ssh/GitCommand.scala +++ b/src/main/scala/gitbucket/core/ssh/GitCommand.scala @@ -105,7 +105,7 @@ abstract class DefaultGitCommand(val owner: String, val repoName: String) extend } } case AuthType.DeployKeyType(key) => { - getDeployKeys(owner, repoName).filter(sshKey => SshUtil.str2PublicKey(sshKey.publicKey).exists(_ == key)) match { + getDeployKeys(owner, repoName).filter(sshKey => SshUtil.str2PublicKey(sshKey.publicKey).contains(key)) match { case List(_) => true case _ => false } @@ -123,7 +123,7 @@ abstract class DefaultGitCommand(val owner: String, val repoName: String) extend } } case AuthType.DeployKeyType(key) => { - getDeployKeys(owner, repoName).filter(sshKey => SshUtil.str2PublicKey(sshKey.publicKey).exists(_ == key)) match { + getDeployKeys(owner, repoName).filter(sshKey => SshUtil.str2PublicKey(sshKey.publicKey).contains(key)) match { case List(x) if x.allowWrite => true case _ => false } diff --git a/src/main/scala/gitbucket/core/ssh/PublicKeyAuthenticator.scala b/src/main/scala/gitbucket/core/ssh/PublicKeyAuthenticator.scala index 814e3e97e..e3be40da2 100644 --- a/src/main/scala/gitbucket/core/ssh/PublicKeyAuthenticator.scala +++ b/src/main/scala/gitbucket/core/ssh/PublicKeyAuthenticator.scala @@ -68,7 +68,7 @@ class PublicKeyAuthenticator(genericUser: String) extends PublickeyAuthenticator private def authenticateGenericUser(userName: String, key: PublicKey, session: ServerSession, genericUser: String)(implicit s: Session): Boolean = { // find all users having the key we got from ssh val possibleUserNames = getAllKeys().filter { sshKey => - SshUtil.str2PublicKey(sshKey.publicKey).exists(_ == key) + SshUtil.str2PublicKey(sshKey.publicKey).contains(key) }.map(_.userName).distinct // determine the user - if different accounts share the same key, tough luck @@ -85,7 +85,7 @@ class PublicKeyAuthenticator(genericUser: String) extends PublickeyAuthenticator }.getOrElse { // search deploy keys val existsDeployKey = getAllDeployKeys().exists { sshKey => - SshUtil.str2PublicKey(sshKey.publicKey).exists(_ == key) + SshUtil.str2PublicKey(sshKey.publicKey).contains(key) } if(existsDeployKey){ // found deploy key for repository From fe5961c59e04376ffd9182d09b2a678f8247306e Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Sun, 2 Apr 2017 15:24:01 +0900 Subject: [PATCH 08/52] use switch --- src/main/java/JettyLauncher.java | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/main/java/JettyLauncher.java b/src/main/java/JettyLauncher.java index d81094181..bae7ae13e 100644 --- a/src/main/java/JettyLauncher.java +++ b/src/main/java/JettyLauncher.java @@ -19,19 +19,25 @@ public class JettyLauncher { if(arg.startsWith("--") && arg.contains("=")) { String[] dim = arg.split("="); if(dim.length >= 2) { - if(dim[0].equals("--host")) { - host = dim[1]; - } else if(dim[0].equals("--port")) { - port = Integer.parseInt(dim[1]); - } else if(dim[0].equals("--prefix")) { - contextPath = dim[1]; - if(!contextPath.startsWith("/")){ - contextPath = "/" + contextPath; - } - } else if(dim[0].equals("--gitbucket.home")){ - System.setProperty("gitbucket.home", dim[1]); - } else if(dim[0].equals("--temp_dir")){ - tmpDirPath = dim[1]; + switch (dim[0]) { + case "--host": + host = dim[1]; + break; + case "--port": + port = Integer.parseInt(dim[1]); + break; + case "--prefix": + contextPath = dim[1]; + if (!contextPath.startsWith("/")) { + contextPath = "/" + contextPath; + } + break; + case "--gitbucket.home": + System.setProperty("gitbucket.home", dim[1]); + break; + case "--temp_dir": + tmpDirPath = dim[1]; + break; } } } From 5eb41d5b2550808836dffa2d29fbc4fd3a63f930 Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Sun, 2 Apr 2017 15:26:29 +0900 Subject: [PATCH 09/52] use "Map#getOrElse" instead of "get().getOrElse" --- src/main/scala/gitbucket/core/plugin/PluginRegistory.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/scala/gitbucket/core/plugin/PluginRegistory.scala b/src/main/scala/gitbucket/core/plugin/PluginRegistory.scala index b299004be..5fd643a7f 100644 --- a/src/main/scala/gitbucket/core/plugin/PluginRegistory.scala +++ b/src/main/scala/gitbucket/core/plugin/PluginRegistory.scala @@ -83,7 +83,7 @@ class PluginRegistry { def addRenderer(extension: String, renderer: Renderer): Unit = renderers += ((extension, renderer)) - def getRenderer(extension: String): Renderer = renderers.get(extension).getOrElse(DefaultRenderer) + def getRenderer(extension: String): Renderer = renderers.getOrElse(extension, DefaultRenderer) def renderableExtensions: Seq[String] = renderers.keys.toSeq From 83a27809efd2fc8a8d3b83a763f798ba2fa35c84 Mon Sep 17 00:00:00 2001 From: KOUNOIKE Yuusuke Date: Sun, 2 Apr 2017 15:42:21 +0900 Subject: [PATCH 10/52] remove .get --- .../gitbucket/core/controller/AccountController.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/scala/gitbucket/core/controller/AccountController.scala b/src/main/scala/gitbucket/core/controller/AccountController.scala index b72c9a94a..4ec340727 100644 --- a/src/main/scala/gitbucket/core/controller/AccountController.scala +++ b/src/main/scala/gitbucket/core/controller/AccountController.scala @@ -151,16 +151,16 @@ trait AccountControllerBase extends AccountManagementControllerBase { get("/:userName/_avatar"){ val userName = params("userName") contentType = "image/png" - getAccountByUserName(userName).map{ account => + getAccountByUserName(userName).flatMap{ account => response.setDateHeader("Last-Modified", account.updatedDate.getTime) account.image.map{ image => - RawData(FileUtil.getMimeType(image), new java.io.File(getUserUploadDir(userName), image)) + Some(RawData(FileUtil.getMimeType(image), new java.io.File(getUserUploadDir(userName), image))) }.getOrElse{ - (if (account.isGroupAccount) { + if (account.isGroupAccount) { TextAvatarUtil.textGroupAvatar(account.fullName) } else { TextAvatarUtil.textAvatar(account.fullName) - }).get + } } }.getOrElse{ response.setHeader("Cache-Control", "max-age=3600") From cfae6d76b23976929cbb044c6ae465bba337a474 Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Sun, 2 Apr 2017 15:32:07 +0900 Subject: [PATCH 11/52] use count instead of "filter().length" --- src/main/scala/gitbucket/core/service/IssuesService.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/scala/gitbucket/core/service/IssuesService.scala b/src/main/scala/gitbucket/core/service/IssuesService.scala index c6c408586..4a9b12c2d 100644 --- a/src/main/scala/gitbucket/core/service/IssuesService.scala +++ b/src/main/scala/gitbucket/core/service/IssuesService.scala @@ -111,7 +111,7 @@ trait IssuesService { val (_, cs) = status.head Some(CommitStatusInfo( count = status.length, - successCount = status.filter(_._2.state == CommitState.SUCCESS).length, + successCount = status.count(_._2.state == CommitState.SUCCESS), context = (if(status.length == 1) Some(cs.context) else None), state = (if(status.length == 1) Some(cs.state) else None), targetUrl = (if(status.length == 1) cs.targetUrl else None), From 445bf1cc342c6f007a464c8431fd724f1ca65faa Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Sun, 2 Apr 2017 15:34:28 +0900 Subject: [PATCH 12/52] remove return --- src/main/scala/gitbucket/core/util/JGitUtil.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/scala/gitbucket/core/util/JGitUtil.scala b/src/main/scala/gitbucket/core/util/JGitUtil.scala index ac1a9b588..3c494aed4 100644 --- a/src/main/scala/gitbucket/core/util/JGitUtil.scala +++ b/src/main/scala/gitbucket/core/util/JGitUtil.scala @@ -952,7 +952,7 @@ object JGitUtil { * @return the last modified commit of specified path */ def getLastModifiedCommit(git: Git, startCommit: RevCommit, path: String): RevCommit = { - return git.log.add(startCommit).addPath(path).setMaxCount(1).call.iterator.next + git.log.add(startCommit).addPath(path).setMaxCount(1).call.iterator.next } def getBranches(owner: String, name: String, defaultBranch: String, origin: Boolean): Seq[BranchInfo] = { From 0aa6e674e9944130d414e0b73a748ae07cc7e056 Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Sun, 2 Apr 2017 15:36:36 +0900 Subject: [PATCH 13/52] use exists instead of "filter().nonEmpty" --- .../scala/gitbucket/core/service/ProtectedBranchService.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/scala/gitbucket/core/service/ProtectedBranchService.scala b/src/main/scala/gitbucket/core/service/ProtectedBranchService.scala index 577b84384..d74280cf7 100644 --- a/src/main/scala/gitbucket/core/service/ProtectedBranchService.scala +++ b/src/main/scala/gitbucket/core/service/ProtectedBranchService.scala @@ -76,7 +76,7 @@ object ProtectedBranchService { includeAdministrators: Boolean) extends AccountService with CommitStatusService { def isAdministrator(pusher: String)(implicit session: Session): Boolean = - pusher == owner || getGroupMembers(owner).filter(gm => gm.userName == pusher && gm.isManager).nonEmpty + pusher == owner || getGroupMembers(owner).exists(gm => gm.userName == pusher && gm.isManager) /** * Can't be force pushed From 2d9727a6959bb53ad98a91b79c8fd12a97016241 Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Sun, 2 Apr 2017 15:41:48 +0900 Subject: [PATCH 14/52] use "contains" instead of "find().isDefined" --- src/main/scala/gitbucket/core/controller/ApiController.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/scala/gitbucket/core/controller/ApiController.scala b/src/main/scala/gitbucket/core/controller/ApiController.scala index ab2a0f1f8..e873ae2b6 100644 --- a/src/main/scala/gitbucket/core/controller/ApiController.scala +++ b/src/main/scala/gitbucket/core/controller/ApiController.scala @@ -125,7 +125,7 @@ trait ApiControllerBase extends ControllerBase { get ("/api/v3/repos/:owner/:repo/branches/:branch")(referrersOnly { repository => //import gitbucket.core.api._ (for{ - branch <- params.get("branch") if repository.branchList.find(_ == branch).isDefined + branch <- params.get("branch") if repository.branchList.contains(branch) br <- getBranches(repository.owner, repository.name, repository.repository.defaultBranch, repository.repository.originUserName.isEmpty).find(_.name == branch) } yield { val protection = getProtectedBranchInfo(repository.owner, repository.name, branch) @@ -287,7 +287,7 @@ trait ApiControllerBase extends ControllerBase { patch("/api/v3/repos/:owner/:repo/branches/:branch")(ownerOnly { repository => import gitbucket.core.api._ (for{ - branch <- params.get("branch") if repository.branchList.find(_ == branch).isDefined + branch <- params.get("branch") if repository.branchList.contains(branch) protection <- extractFromJsonBody[ApiBranchProtection.EnablingAndDisabling].map(_.protection) br <- getBranches(repository.owner, repository.name, repository.repository.defaultBranch, repository.repository.originUserName.isEmpty).find(_.name == branch) } yield { From ee8be37f55cfb5bc24b7f412c74aae14fd109313 Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Sun, 2 Apr 2017 15:48:46 +0900 Subject: [PATCH 15/52] use "contains" instead of "find().isEmpty" --- .../core/controller/RepositorySettingsController.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/scala/gitbucket/core/controller/RepositorySettingsController.scala b/src/main/scala/gitbucket/core/controller/RepositorySettingsController.scala index 0ca0305c5..7e016a570 100644 --- a/src/main/scala/gitbucket/core/controller/RepositorySettingsController.scala +++ b/src/main/scala/gitbucket/core/controller/RepositorySettingsController.scala @@ -157,7 +157,7 @@ trait RepositorySettingsControllerBase extends ControllerBase { /** Update default branch */ post("/:owner/:repository/settings/update_default_branch", defaultBranchForm)(ownerOnly { (form, repository) => - if(repository.branchList.find(_ == form.defaultBranch).isEmpty){ + if(!repository.branchList.contains(form.defaultBranch)){ redirect(s"/${repository.owner}/${repository.name}/settings/options") } else { saveRepositoryDefaultBranch(repository.owner, repository.name, form.defaultBranch) @@ -174,7 +174,7 @@ trait RepositorySettingsControllerBase extends ControllerBase { get("/:owner/:repository/settings/branches/:branch")(ownerOnly { repository => import gitbucket.core.api._ val branch = params("branch") - if(repository.branchList.find(_ == branch).isEmpty){ + if(!repository.branchList.contains(branch)){ redirect(s"/${repository.owner}/${repository.name}/settings/branches") } else { val protection = ApiBranchProtection(getProtectedBranchInfo(repository.owner, repository.name, branch)) From 968c45c77d2072fa529cae23a6239cf0d425d6cd Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Sun, 2 Apr 2017 15:49:10 +0900 Subject: [PATCH 16/52] use "exists" instead of "find().isEmpty" --- src/main/scala/gitbucket/core/service/WikiService.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/scala/gitbucket/core/service/WikiService.scala b/src/main/scala/gitbucket/core/service/WikiService.scala index c5dad27d0..ab034fc1e 100644 --- a/src/main/scala/gitbucket/core/service/WikiService.scala +++ b/src/main/scala/gitbucket/core/service/WikiService.scala @@ -177,7 +177,7 @@ trait WikiService { val headId = git.getRepository.resolve(Constants.HEAD + "^{commit}") JGitUtil.processTree(git, headId){ (path, tree) => - if(revertInfo.find(x => x.filePath == path).isEmpty){ + if(!revertInfo.exists(x => x.filePath == path)){ builder.add(JGitUtil.createDirCacheEntry(path, tree.getEntryFileMode, tree.getEntryObjectId)) } } From 2a3e4af0820036d8cd5a66857b28b05056d8fa63 Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Sun, 2 Apr 2017 15:58:38 +0900 Subject: [PATCH 17/52] update MySQL v5_7_latest in test v5_7_10 does not work Sierra https://github.com/wix/wix-embedded-mysql/blob/wix-embedded-mysql-2.1.4/src/main/java/com/wix/mysql/distribution/Version.java#L86 --- src/test/scala/gitbucket/core/GitBucketCoreModuleSpec.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/scala/gitbucket/core/GitBucketCoreModuleSpec.scala b/src/test/scala/gitbucket/core/GitBucketCoreModuleSpec.scala index 8f2d7c70c..449e8db85 100644 --- a/src/test/scala/gitbucket/core/GitBucketCoreModuleSpec.scala +++ b/src/test/scala/gitbucket/core/GitBucketCoreModuleSpec.scala @@ -29,7 +29,7 @@ class GitBucketCoreModuleSpec extends FunSuite { } test("Migration MySQL", ExternalDBTest){ - val config = aMysqldConfig(v5_7_10) + val config = aMysqldConfig(v5_7_latest) .withPort(3306) .withUser("sa", "sa") .withCharset(Charset.UTF8) From 1e715d8b06680230a579392bad1f7f44c75a115e Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Sun, 2 Apr 2017 16:07:23 +0900 Subject: [PATCH 18/52] s/newInstance()/getDeclaredConstructor().newInstance() java.lang.Class#newInstance deprecated since Java 9 http://download.java.net/java/jdk9/docs/api/java/lang/Class.html#newInstance-- --- src/main/scala/gitbucket/core/plugin/PluginRegistory.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/scala/gitbucket/core/plugin/PluginRegistory.scala b/src/main/scala/gitbucket/core/plugin/PluginRegistory.scala index b299004be..c0bc923dc 100644 --- a/src/main/scala/gitbucket/core/plugin/PluginRegistory.scala +++ b/src/main/scala/gitbucket/core/plugin/PluginRegistory.scala @@ -175,7 +175,7 @@ object PluginRegistry { }).foreach { pluginJar => val classLoader = new URLClassLoader(Array(pluginJar.toURI.toURL), Thread.currentThread.getContextClassLoader) try { - val plugin = classLoader.loadClass("Plugin").newInstance().asInstanceOf[Plugin] + val plugin = classLoader.loadClass("Plugin").getDeclaredConstructor().newInstance().asInstanceOf[Plugin] // Migration val solidbase = new Solidbase() From 68c2f832ac6064f6b5b58c4a62af9ff82b938d83 Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Wed, 5 Apr 2017 01:46:57 +0900 Subject: [PATCH 19/52] (refs #1523)Eliminate CR and LF in public key --- .../core/controller/AccountController.scala | 22 +++++++++---------- .../core/controller/ControllerBase.scala | 12 ++++++++++ .../RepositorySettingsController.scala | 2 +- .../scala/gitbucket/core/ssh/SshUtil.scala | 21 +++++++++--------- 4 files changed, 35 insertions(+), 22 deletions(-) diff --git a/src/main/scala/gitbucket/core/controller/AccountController.scala b/src/main/scala/gitbucket/core/controller/AccountController.scala index 139470232..5a427b377 100644 --- a/src/main/scala/gitbucket/core/controller/AccountController.scala +++ b/src/main/scala/gitbucket/core/controller/AccountController.scala @@ -61,31 +61,31 @@ trait AccountControllerBase extends AccountManagementControllerBase { val sshKeyForm = mapping( "title" -> trim(label("Title", text(required, maxlength(100)))), - "publicKey" -> trim(label("Key" , text(required, validPublicKey))) + "publicKey" -> trim2(label("Key" , text(required, validPublicKey))) )(SshKeyForm.apply) val personalTokenForm = mapping( - "note" -> trim(label("Token", text(required, maxlength(100)))) + "note" -> trim(label("Token", text(required, maxlength(100)))) )(PersonalTokenForm.apply) case class NewGroupForm(groupName: String, description: Option[String], url: Option[String], fileId: Option[String], members: String) case class EditGroupForm(groupName: String, description: Option[String], url: Option[String], fileId: Option[String], members: String, clearImage: Boolean) val newGroupForm = mapping( - "groupName" -> trim(label("Group name" ,text(required, maxlength(100), identifier, uniqueUserName, reservedNames))), + "groupName" -> trim(label("Group name" ,text(required, maxlength(100), identifier, uniqueUserName, reservedNames))), "description" -> trim(label("Group description", optional(text()))), - "url" -> trim(label("URL" ,optional(text(maxlength(200))))), - "fileId" -> trim(label("File ID" ,optional(text()))), - "members" -> trim(label("Members" ,text(required, members))) + "url" -> trim(label("URL" ,optional(text(maxlength(200))))), + "fileId" -> trim(label("File ID" ,optional(text()))), + "members" -> trim(label("Members" ,text(required, members))) )(NewGroupForm.apply) val editGroupForm = mapping( - "groupName" -> trim(label("Group name" ,text(required, maxlength(100), identifier))), + "groupName" -> trim(label("Group name" ,text(required, maxlength(100), identifier))), "description" -> trim(label("Group description", optional(text()))), - "url" -> trim(label("URL" ,optional(text(maxlength(200))))), - "fileId" -> trim(label("File ID" ,optional(text()))), - "members" -> trim(label("Members" ,text(required, members))), - "clearImage" -> trim(label("Clear image" ,boolean())) + "url" -> trim(label("URL" ,optional(text(maxlength(200))))), + "fileId" -> trim(label("File ID" ,optional(text()))), + "members" -> trim(label("Members" ,text(required, members))), + "clearImage" -> trim(label("Clear image" ,boolean())) )(EditGroupForm.apply) case class RepositoryCreationForm(owner: String, name: String, description: Option[String], isPrivate: Boolean, createReadme: Boolean) diff --git a/src/main/scala/gitbucket/core/controller/ControllerBase.scala b/src/main/scala/gitbucket/core/controller/ControllerBase.scala index ceff777f9..08a294193 100644 --- a/src/main/scala/gitbucket/core/controller/ControllerBase.scala +++ b/src/main/scala/gitbucket/core/controller/ControllerBase.scala @@ -159,6 +159,18 @@ abstract class ControllerBase extends ScalatraFilter if (path.startsWith("http")) path else baseUrl + super.url(path, params, false, false, false) + /** + * Extends scalatra-form's trim rule to eliminate CR and LF. + */ + protected def trim2[T](valueType: SingleValueType[T]): SingleValueType[T] = new SingleValueType[T](){ + def convert(value: String, messages: Messages): T = valueType.convert(trim(value), messages) + + override def validate(name: String, value: String, params: Map[String, String], messages: Messages): Seq[(String, String)] = + valueType.validate(name, trim(value), params, messages) + + private def trim(value: String): String = if(value == null) null else value.replaceAll("\r\n", "").trim + } + /** * Use this method to response the raw data against XSS. */ diff --git a/src/main/scala/gitbucket/core/controller/RepositorySettingsController.scala b/src/main/scala/gitbucket/core/controller/RepositorySettingsController.scala index 0ca0305c5..356de85d7 100644 --- a/src/main/scala/gitbucket/core/controller/RepositorySettingsController.scala +++ b/src/main/scala/gitbucket/core/controller/RepositorySettingsController.scala @@ -63,7 +63,7 @@ trait RepositorySettingsControllerBase extends ControllerBase { val deployKeyForm = mapping( "title" -> trim(label("Title", text(required, maxlength(100)))), - "publicKey" -> trim(label("Key" , text(required))), // TODO duplication check in the repository? + "publicKey" -> trim2(label("Key" , text(required))), // TODO duplication check in the repository? "allowWrite" -> trim(label("Key" , boolean())) )(DeployKeyForm.apply) diff --git a/src/main/scala/gitbucket/core/ssh/SshUtil.scala b/src/main/scala/gitbucket/core/ssh/SshUtil.scala index 62eb97a7b..9563ab3c8 100644 --- a/src/main/scala/gitbucket/core/ssh/SshUtil.scala +++ b/src/main/scala/gitbucket/core/ssh/SshUtil.scala @@ -18,16 +18,17 @@ object SshUtil { val parts = key.split(" ") if (parts.size < 2) { logger.debug(s"Invalid PublicKey Format: ${key}") - return None - } - try { - val encodedKey = parts(1) - val decode = Base64.getDecoder.decode(Constants.encodeASCII(encodedKey)) - Some(new ByteArrayBuffer(decode).getRawPublicKey) - } catch { - case e: Throwable => - logger.debug(e.getMessage, e) - None + None + } else { + try { + val encodedKey = parts(1) + val decode = Base64.getDecoder.decode(Constants.encodeASCII(encodedKey)) + Some(new ByteArrayBuffer(decode).getRawPublicKey) + } catch { + case e: Throwable => + logger.debug(e.getMessage, e) + None + } } } From 956af54d4f9aec4d03341412670807619d42665a Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Wed, 5 Apr 2017 01:48:24 +0900 Subject: [PATCH 20/52] Remove outdated TODO --- .../gitbucket/core/controller/ControllerBase.scala | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/main/scala/gitbucket/core/controller/ControllerBase.scala b/src/main/scala/gitbucket/core/controller/ControllerBase.scala index 08a294193..de80f9774 100644 --- a/src/main/scala/gitbucket/core/controller/ControllerBase.scala +++ b/src/main/scala/gitbucket/core/controller/ControllerBase.scala @@ -40,10 +40,6 @@ abstract class ControllerBase extends ScalatraFilter contentType = formats("json") } -// TODO Scala 2.11 -// // Don't set content type via Accept header. -// override def format(implicit request: HttpServletRequest) = "" - override def doFilter(request: ServletRequest, response: ServletResponse, chain: FilterChain): Unit = try { val httpRequest = request.asInstanceOf[HttpServletRequest] val httpResponse = response.asInstanceOf[HttpServletResponse] @@ -151,14 +147,6 @@ abstract class ControllerBase extends ScalatraFilter } } - // TODO Scala 2.11 - override def url(path: String, params: Iterable[(String, Any)] = Iterable.empty, - includeContextPath: Boolean = true, includeServletPath: Boolean = true, - absolutize: Boolean = true, withSessionId: Boolean = true) - (implicit request: HttpServletRequest, response: HttpServletResponse): String = - if (path.startsWith("http")) path - else baseUrl + super.url(path, params, false, false, false) - /** * Extends scalatra-form's trim rule to eliminate CR and LF. */ From c581d9e6b9d3aef5b455c3ed4eae36871687cddb Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Wed, 5 Apr 2017 01:48:36 +0900 Subject: [PATCH 21/52] Remove unused import statement --- src/main/scala/gitbucket/core/controller/AccountController.scala | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/scala/gitbucket/core/controller/AccountController.scala b/src/main/scala/gitbucket/core/controller/AccountController.scala index dedba1a82..51dd1d124 100644 --- a/src/main/scala/gitbucket/core/controller/AccountController.scala +++ b/src/main/scala/gitbucket/core/controller/AccountController.scala @@ -15,7 +15,6 @@ import io.github.gitbucket.scalatra.forms._ import org.apache.commons.io.FileUtils import org.scalatra.i18n.Messages import org.scalatra.BadRequest -import java.util.Date class AccountController extends AccountControllerBase From 6a520061cfa6088c59ec2e588525b7f400213570 Mon Sep 17 00:00:00 2001 From: kenji yoshida <6b656e6a69@gmail.com> Date: Thu, 6 Apr 2017 07:10:35 +0900 Subject: [PATCH 22/52] s/2.11/2.12 --- doc/how_to_run.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/how_to_run.md b/doc/how_to_run.md index ea3190923..77c1f5d3d 100644 --- a/doc/how_to_run.md +++ b/doc/how_to_run.md @@ -23,7 +23,7 @@ To build war file, run the following command: $ sbt package ``` -`gitbucket_2.11-x.x.x.war` is generated into `target/scala-2.11`. +`gitbucket_2.12-x.x.x.war` is generated into `target/scala-2.12`. To build executable war file, run From 34c1fce8a276f90d0159627c0d5e9c624a6060a0 Mon Sep 17 00:00:00 2001 From: Yasuhiro Takagi Date: Sun, 9 Apr 2017 16:57:52 +0900 Subject: [PATCH 23/52] To have comatibility with GitHub/GitHubEnerprise. When downloding archive file, GH/GHE use "-" as escape character for "/" in brach name. --- .../gitbucket/core/controller/RepositoryViewerController.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala b/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala index 1b4ecc984..c5b50b135 100644 --- a/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala +++ b/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala @@ -672,7 +672,7 @@ trait RepositoryViewerControllerBase extends ControllerBase { val revision = name.stripSuffix(suffix) val filename = repository.name + "-" + - (if(revision.length == 40) revision.substring(0, 10) else revision).replace('/', '_') + suffix + (if(revision.length == 40) revision.substring(0, 10) else revision).replace('/', '-') + suffix using(Git.open(getRepositoryDir(repository.owner, repository.name))){ git => val revCommit = JGitUtil.getRevCommitFromId(git, git.getRepository.resolve(revision)) From b736f904e9c5ce745731965619a8e05cf1135e1e Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Sun, 9 Apr 2017 21:43:58 +0900 Subject: [PATCH 24/52] (refs #1333)Bump to JGit 4.7.0 --- build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 25ee799ad..b7c12bce3 100644 --- a/build.sbt +++ b/build.sbt @@ -21,8 +21,8 @@ resolvers ++= Seq( "amateras-snapshot" at "http://amateras.sourceforge.jp/mvn-snapshot/" ) libraryDependencies ++= Seq( - "org.eclipse.jgit" % "org.eclipse.jgit.http.server" % "4.6.1.201703071140-r", - "org.eclipse.jgit" % "org.eclipse.jgit.archive" % "4.6.1.201703071140-r", + "org.eclipse.jgit" % "org.eclipse.jgit.http.server" % "4.7.0.201704051617-r", + "org.eclipse.jgit" % "org.eclipse.jgit.archive" % "4.7.0.201704051617-r", "org.scalatra" %% "scalatra" % ScalatraVersion, "org.scalatra" %% "scalatra-json" % ScalatraVersion, "org.json4s" %% "json4s-jackson" % "3.5.0", From e3c6621398ca17ae42b8787b7f138defc35d6339 Mon Sep 17 00:00:00 2001 From: adrian Date: Sun, 9 Apr 2017 15:18:54 +0200 Subject: [PATCH 25/52] improve wording. (cherry picked from commit ce7d7340f715d53cd04da94ae5924b2771294490) --- README.md | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index b9222ea0a..432c43cd1 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,21 @@ GitBucket [![Gitter chat](https://badges.gitter.im/gitbucket/gitbucket.png)](https://gitter.im/gitbucket/gitbucket) [![Build Status](https://travis-ci.org/gitbucket/gitbucket.svg?branch=master)](https://travis-ci.org/gitbucket/gitbucket) ========= -GitBucket is a Git platform powered by Scala offering: +GitBucket is a Git web platform powered by Scala offering: - Easy installation +- Intuitive UI - High extensibility by plugins - API compatibility with GitHub Features -------- -The current version of GitBucket provides a basic features below: +The current version of GitBucket provides many features such as: - Public / Private Git repository (http and ssh access) - GitLFS support -- Repository viewer includes online file editor +- Repository viewer including an online file editor - Issues, Pull request and Wiki for repositories -- Activity timeline and email notification +- Activity timeline and email notifications - Account and group management with LDAP integration - Plug-in system @@ -22,7 +23,7 @@ If you want to try the development version of GitBucket, see the [Developer's Gu Installation -------- -GitBucket requires **Java8**. You have to install it if it is not already installed. +GitBucket requires **Java8**. You have to install it, if it is not already installed. 1. Download the latest **gitbucket.war** from [the releases page](https://github.com/gitbucket/gitbucket/releases) and run it by `java -jar gitbucket.war`. 2. Go to `http://[hostname]:8080/` and log in with **root** / **root**. @@ -45,21 +46,24 @@ To upgrade GitBucket, replace `gitbucket.war` with the new version, after stoppi Plugins -------- -GitBucket has a plug-in system to allow extensions to GitBucket. We provide some official plug-ins: +GitBucket has a plug-in system that allows extra functionality. Officially the following plug-ins are provided: - [gitbucket-gist-plugin](https://github.com/gitbucket/gitbucket-gist-plugin) - [gitbucket-emoji-plugin](https://github.com/gitbucket/gitbucket-emoji-plugin) +- [gitbucket-pages-plugin](https://github.com/gitbucket/gitbucket-pages-plugin) +- [gitbucket-h2-backup-plugin](https://github.com/gitbucket-plugins/gitbucket-h2-backup-plugin) +- [https://github.com/gitbucket-plugins/gitbucket-announce-plugin](https://github.com/gitbucket-plugins/gitbucket-announce-plugin) You can find more plugins made by the community at [GitBucket community plugins](http://gitbucket-plugins.github.io/). Support -------- -- If you have any questions about GitBucket, send it to the [gitter room](https://gitter.im/gitbucket/gitbucket) before opening an issue. -- Make sure check whether there is the same question or request in the past. -- When raise a new issue, write at least the subject in **English**. -- We can also provide support in Japanese at [gitter room for Japanese](https://gitter.im/gitbucket/gitbucket_ja). -- The first priority of GitBucket is easy installation and API compatibility with GitHub, so we might reject if your request is against it. +- If you have any questions about GitBucket, please use the [gitter room](https://gitter.im/gitbucket/gitbucket) before opening any issue. +- Make sure to check whether the same question or request was answered in the past (see the closed issues). +- When raising a new issue, please write at least the subject in **English**. +- We also provide support in Japanese at [gitter room for Japanese](https://gitter.im/gitbucket/gitbucket_ja). +- The highest priority of GitBucket is the ease of installation and API compatibility with GitHub, so your feature request might be rejected if they go against those principles. Release Notes ------------- From 9df2c221dfd723fe1440b9ad05d937eca3c194ec Mon Sep 17 00:00:00 2001 From: adrian Date: Sun, 9 Apr 2017 15:19:29 +0200 Subject: [PATCH 26/52] improve wording. (cherry picked from commit a184767d9c60d3008ed296cef892cb4880dfede9) --- doc/how_to_run.md | 12 ++++++------ doc/notification.md | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/how_to_run.md b/doc/how_to_run.md index 77c1f5d3d..237dd68fc 100644 --- a/doc/how_to_run.md +++ b/doc/how_to_run.md @@ -4,15 +4,15 @@ How to run from the source tree Run for Development -------- -If you want to test GitBucket, input following command at the root directory of the source tree. +If you want to test GitBucket, type the following command in the root directory of the source tree. ``` $ sbt ~jetty:start ``` -Then access to `http://localhost:8080/` by your browser. The default administrator account is `root` and password is `root`. +Then access `http://localhost:8080/` in your browser. The default administrator account is `root` and password is `root`. -Source code modification is detected and reloaded automatically. You can modify logging configuration by editing `src/main/resources/logback-dev.xml`. +Source code modifications are detected and a reloaded happens automatically. You can modify the logging configuration by editing `src/main/resources/logback-dev.xml`. Build war file -------- @@ -25,7 +25,7 @@ $ sbt package `gitbucket_2.12-x.x.x.war` is generated into `target/scala-2.12`. -To build executable war file, run +To build an executable war file, run ``` $ sbt executable @@ -35,8 +35,8 @@ at the top of the source tree. It generates executable `gitbucket.war` into `tar Run tests spec --------- -To run the full serie of tests, run the following command: +To run the full series of tests, run the following command: ``` -sbt test +$ sbt test ``` diff --git a/doc/notification.md b/doc/notification.md index 90a88bbb3..f9fb1e0de 100644 --- a/doc/notification.md +++ b/doc/notification.md @@ -1,7 +1,7 @@ Notification Email ======== -GitBucket sends email to target users by enabling the notification email by an administrator. +GitBucket can send email notification to users if this feature is enabled by an administrator. The timing of the notification are as follows: @@ -20,4 +20,4 @@ Notified users are as follows: * collaborators * participants -However, the operation in person is excluded from the target. +However, the person performing the operation is excluded from the notification. From 9793bfc07409932eddf13bf63f13b8745a46ba99 Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Mon, 10 Apr 2017 00:54:43 +0900 Subject: [PATCH 27/52] Remove plugins outside the gitbucket organization --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 432c43cd1..14f245b3d 100644 --- a/README.md +++ b/README.md @@ -51,8 +51,6 @@ GitBucket has a plug-in system that allows extra functionality. Officially the f - [gitbucket-gist-plugin](https://github.com/gitbucket/gitbucket-gist-plugin) - [gitbucket-emoji-plugin](https://github.com/gitbucket/gitbucket-emoji-plugin) - [gitbucket-pages-plugin](https://github.com/gitbucket/gitbucket-pages-plugin) -- [gitbucket-h2-backup-plugin](https://github.com/gitbucket-plugins/gitbucket-h2-backup-plugin) -- [https://github.com/gitbucket-plugins/gitbucket-announce-plugin](https://github.com/gitbucket-plugins/gitbucket-announce-plugin) You can find more plugins made by the community at [GitBucket community plugins](http://gitbucket-plugins.github.io/). From 650aff56499ed41b3bed44b4c955660fcd885585 Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Mon, 10 Apr 2017 01:08:58 +0900 Subject: [PATCH 28/52] (refs #1383)Add demo site information --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 14f245b3d..b85b84c3d 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,14 @@ GitBucket [![Gitter chat](https://badges.gitter.im/gitbucket/gitbucket.png)](htt ========= GitBucket is a Git web platform powered by Scala offering: + - Easy installation - Intuitive UI - High extensibility by plugins - API compatibility with GitHub +You can touch GitBucket at the [demo site](https://gitbucket.herokuapp.com/) (ID: root / Pass: root) and get the latest information at [GitBucket News](https://gitbucket.github.io/gitbucket-news/). + Features -------- The current version of GitBucket provides many features such as: @@ -26,7 +29,7 @@ Installation GitBucket requires **Java8**. You have to install it, if it is not already installed. 1. Download the latest **gitbucket.war** from [the releases page](https://github.com/gitbucket/gitbucket/releases) and run it by `java -jar gitbucket.war`. -2. Go to `http://[hostname]:8080/` and log in with **root** / **root**. +2. Go to `http://[hostname]:8080/` and log in with ID: **root** / Pass: **root**. You can specify following options: From 74e940ea3c1f39390f11bb92f71f36cf2cf191fc Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Mon, 10 Apr 2017 01:13:28 +0900 Subject: [PATCH 29/52] Update support policy --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b85b84c3d..d7f35d258 100644 --- a/README.md +++ b/README.md @@ -60,10 +60,9 @@ You can find more plugins made by the community at [GitBucket community plugins] Support -------- -- If you have any questions about GitBucket, please use the [gitter room](https://gitter.im/gitbucket/gitbucket) before opening any issue. -- Make sure to check whether the same question or request was answered in the past (see the closed issues). -- When raising a new issue, please write at least the subject in **English**. -- We also provide support in Japanese at [gitter room for Japanese](https://gitter.im/gitbucket/gitbucket_ja). +- If you have any questions about GitBucket, check [wiki](https://github.com/gitbucket/gitbucket/wiki) and make sure to check whether the same question or request was answered in the past (see the closed issues) at first. +- Send your question to the [gitter room](https://gitter.im/gitbucket/gitbucket) instead of raising issue. +- We can provide support in Japanese at [gitter room for Japanese](https://gitter.im/gitbucket/gitbucket_ja). - The highest priority of GitBucket is the ease of installation and API compatibility with GitHub, so your feature request might be rejected if they go against those principles. Release Notes From f40bdb6494a2fd79ad033a5fafec1575788dd348 Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Mon, 10 Apr 2017 01:17:43 +0900 Subject: [PATCH 30/52] Update issues guideline --- .github/CONTRIBUTING.md | 5 +++-- README.md | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 49d184a25..507d345c7 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,6 +1,7 @@ # Guideline for Issues -- At first, See [FAQ](https://github.com/gitbucket/gitbucket/wiki/FAQ) and check issues whether there is a same question or request in the past. +- At first, see [Wiki](https://github.com/gitbucket/gitbucket/wiki) and check issues whether there is a same question or request in the past. - If you can't find same question and report, send it to [gitter room](https://gitter.im/gitbucket/gitbucket) before raising an issue. -- We can also support in Japaneses other than English at [gitter room for Japanese](https://gitter.im/gitbucket/gitbucket_ja). +- We can also support in Japanese other than English at [gitter room for Japanese](https://gitter.im/gitbucket/gitbucket_ja). - Write an issue in English. At least, write subject in English. +- The highest priority of GitBucket is the ease of installation and API compatibility with GitHub, so your feature request might be rejected if they go against those principles. diff --git a/README.md b/README.md index d7f35d258..0aec35581 100644 --- a/README.md +++ b/README.md @@ -60,9 +60,10 @@ You can find more plugins made by the community at [GitBucket community plugins] Support -------- -- If you have any questions about GitBucket, check [wiki](https://github.com/gitbucket/gitbucket/wiki) and make sure to check whether the same question or request was answered in the past (see the closed issues) at first. -- Send your question to the [gitter room](https://gitter.im/gitbucket/gitbucket) instead of raising issue. -- We can provide support in Japanese at [gitter room for Japanese](https://gitter.im/gitbucket/gitbucket_ja). +- If you have any questions about GitBucket, see [Wiki](https://github.com/gitbucket/gitbucket/wiki) and check issues whether there is a same question or request in the past. +- If you can't find same question and report, send it to [gitter room](https://gitter.im/gitbucket/gitbucket) before raising an issue. +- We can also provide support in Japanese other than English at [gitter room for Japanese](https://gitter.im/gitbucket/gitbucket_ja). +- Write an issue in English. At least, write subject in English. - The highest priority of GitBucket is the ease of installation and API compatibility with GitHub, so your feature request might be rejected if they go against those principles. Release Notes From fce8cbdaefc881c28a98c9c260118d835b0099b2 Mon Sep 17 00:00:00 2001 From: aadrian Date: Sun, 9 Apr 2017 18:55:02 +0200 Subject: [PATCH 31/52] improve workding --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0aec35581..4145be584 100644 --- a/README.md +++ b/README.md @@ -8,19 +8,19 @@ GitBucket is a Git web platform powered by Scala offering: - High extensibility by plugins - API compatibility with GitHub -You can touch GitBucket at the [demo site](https://gitbucket.herokuapp.com/) (ID: root / Pass: root) and get the latest information at [GitBucket News](https://gitbucket.github.io/gitbucket-news/). +You can try an [online demo](https://gitbucket.herokuapp.com/) *(ID: root / Pass: root)* of GitBucket, and also get the latest information at [GitBucket News](https://gitbucket.github.io/gitbucket-news/). Features -------- The current version of GitBucket provides many features such as: -- Public / Private Git repository (http and ssh access) +- Public / Private Git repositories (with http/https and ssh access) - GitLFS support - Repository viewer including an online file editor -- Issues, Pull request and Wiki for repositories +- Issues, Pull Requests and Wiki for repositories - Activity timeline and email notifications - Account and group management with LDAP integration -- Plug-in system +- a Plug-in system If you want to try the development version of GitBucket, see the [Developer's Guide](https://github.com/gitbucket/gitbucket/blob/master/doc/how_to_run.md). From b218c2284e82ebcf0884ab9c03db264eca71c9fc Mon Sep 17 00:00:00 2001 From: Yasuhiro Takagi Date: Mon, 10 Apr 2017 21:21:47 +0900 Subject: [PATCH 32/52] To have compatibility with GitHub/GitHubEnterprise when archive downloading with sha1, even if supplied part of sha1, GH/GHE gives a filename with full(long) sha1. This patch make GitBucket to be compatible with GH/GHE behaviour. You can check that difference by following url. I upload same repo as in GitHuB to GitBucket demo site. GitHub: https://github.com/MunGell/awesome-for-beginners/archive/fc7d067.tar.gz GitBucket: http://gitbucket.herokuapp.com/root/awesome-for-beginners/archive/fc7d067.tar.gz GH returns, awesome-for-beginners-fc7d067cb13559f248bb362253ff2fa3b2617aba.tar.gz Otherwise GitBucket returns, awesome-for-beginners-fc7d067.tar.gz --- .../core/controller/RepositoryViewerController.scala | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala b/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala index 23eb612cf..f1eb9f2ae 100644 --- a/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala +++ b/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala @@ -670,12 +670,14 @@ trait RepositoryViewerControllerBase extends ControllerBase { private def archiveRepository(name: String, suffix: String, repository: RepositoryService.RepositoryInfo): Unit = { val revision = name.stripSuffix(suffix) - - val filename = repository.name + "-" + - (if(revision.length == 40) revision.substring(0, 10) else revision).replace('/', '-') + suffix - + using(Git.open(getRepositoryDir(repository.owner, repository.name))){ git => val revCommit = JGitUtil.getRevCommitFromId(git, git.getRepository.resolve(revision)) + + val sha1 = git.getRepository.resolve(revision).getName() + + val filename = repository.name + "-" + + (if(sha1.startsWith(revision)) sha1 else revision).replace('/','-') + suffix contentType = "application/octet-stream" response.setHeader("Content-Disposition", s"attachment; filename=${filename}") From c0320d3139d5f3bb7d30bbe76a3573dac599f18b Mon Sep 17 00:00:00 2001 From: Yasuhiro Takagi Date: Tue, 11 Apr 2017 22:41:55 +0900 Subject: [PATCH 33/52] I refactor some code. --- .../core/controller/RepositoryViewerController.scala | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala b/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala index f1eb9f2ae..81579f559 100644 --- a/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala +++ b/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala @@ -672,10 +672,9 @@ trait RepositoryViewerControllerBase extends ControllerBase { val revision = name.stripSuffix(suffix) using(Git.open(getRepositoryDir(repository.owner, repository.name))){ git => - val revCommit = JGitUtil.getRevCommitFromId(git, git.getRepository.resolve(revision)) - - val sha1 = git.getRepository.resolve(revision).getName() - + val oid = git.getRepository.resolve(revision) + val revCommit = JGitUtil.getRevCommitFromId(git, oid) + val sha1 = oid.getName() val filename = repository.name + "-" + (if(sha1.startsWith(revision)) sha1 else revision).replace('/','-') + suffix From ed543847a8867a235e2fbda8173bd55ace66e5d4 Mon Sep 17 00:00:00 2001 From: Damian Bronecki Date: Thu, 13 Apr 2017 20:43:20 +0200 Subject: [PATCH 34/52] Fixes #1481 --- src/main/scala/gitbucket/core/model/Milestone.scala | 8 ++++---- .../scala/gitbucket/core/service/MilestonesService.scala | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/scala/gitbucket/core/model/Milestone.scala b/src/main/scala/gitbucket/core/model/Milestone.scala index 81c4f2b89..491fefded 100644 --- a/src/main/scala/gitbucket/core/model/Milestone.scala +++ b/src/main/scala/gitbucket/core/model/Milestone.scala @@ -9,10 +9,10 @@ trait MilestoneComponent extends TemplateComponent { self: Profile => class Milestones(tag: Tag) extends Table[Milestone](tag, "MILESTONE") with MilestoneTemplate { override val milestoneId = column[Int]("MILESTONE_ID", O AutoInc) val title = column[String]("TITLE") - val description = column[String]("DESCRIPTION") - val dueDate = column[java.util.Date]("DUE_DATE") - val closedDate = column[java.util.Date]("CLOSED_DATE") - def * = (userName, repositoryName, milestoneId, title, description.?, dueDate.?, closedDate.?) <> (Milestone.tupled, Milestone.unapply) + val description = column[Option[String]]("DESCRIPTION") + val dueDate = column[Option[java.util.Date]]("DUE_DATE") + val closedDate = column[Option[java.util.Date]]("CLOSED_DATE") + def * = (userName, repositoryName, milestoneId, title, description, dueDate, closedDate) <> (Milestone.tupled, Milestone.unapply) def byPrimaryKey(owner: String, repository: String, milestoneId: Int) = byMilestone(owner, repository, milestoneId) def byPrimaryKey(userName: Rep[String], repositoryName: Rep[String], milestoneId: Rep[Int]) = byMilestone(userName, repositoryName, milestoneId) diff --git a/src/main/scala/gitbucket/core/service/MilestonesService.scala b/src/main/scala/gitbucket/core/service/MilestonesService.scala index 1e9585687..276aa7c10 100644 --- a/src/main/scala/gitbucket/core/service/MilestonesService.scala +++ b/src/main/scala/gitbucket/core/service/MilestonesService.scala @@ -21,7 +21,7 @@ trait MilestonesService { def updateMilestone(milestone: Milestone)(implicit s: Session): Unit = Milestones .filter (t => t.byPrimaryKey(milestone.userName, milestone.repositoryName, milestone.milestoneId)) - .map (t => (t.title, t.description.?, t.dueDate.?, t.closedDate.?)) + .map (t => (t.title, t.description, t.dueDate, t.closedDate)) .update (milestone.title, milestone.description, milestone.dueDate, milestone.closedDate) def openMilestone(milestone: Milestone)(implicit s: Session): Unit = From 7c4a2869373961bff352d98f1e857c47de42f686 Mon Sep 17 00:00:00 2001 From: Damian Bronecki Date: Sat, 15 Apr 2017 23:20:57 +0200 Subject: [PATCH 35/52] Fixes #1539 --- src/main/webapp/assets/common/css/gitbucket.css | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/webapp/assets/common/css/gitbucket.css b/src/main/webapp/assets/common/css/gitbucket.css index c2b225ddd..45e4f1013 100644 --- a/src/main/webapp/assets/common/css/gitbucket.css +++ b/src/main/webapp/assets/common/css/gitbucket.css @@ -556,6 +556,7 @@ pre.commit-description { background-color: transparent; padding: 2px; margin: 0px; + white-space: pre-wrap; } #repository-url { From e576e14460c190e92de45dd7d5776e4c5256b757 Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Sun, 16 Apr 2017 15:30:29 +0900 Subject: [PATCH 36/52] Update database configuration warning message --- src/main/twirl/gitbucket/core/admin/system.scala.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/twirl/gitbucket/core/admin/system.scala.html b/src/main/twirl/gitbucket/core/admin/system.scala.html index 46de04c5c..4234243d9 100644 --- a/src/main/twirl/gitbucket/core/admin/system.scala.html +++ b/src/main/twirl/gitbucket/core/admin/system.scala.html @@ -24,9 +24,9 @@ @if(DatabaseConfig.url.startsWith("jdbc:h2:")) {

@gitbucket.core.util.DatabaseConfig.url

-

Embedded H2 database should be used for evaluation purpose only.

- Please configure using external database explained here. + Your GitBucket is running on embedded H2 database. + Recommend to configure to use external database if you would like to use GitBucket for important purpose.

}else{ From 835f35393e81c67e6707d54f41359084eb118334 Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Tue, 18 Apr 2017 11:31:03 +0900 Subject: [PATCH 37/52] Don't retrieve unused repository information when withoutPhysicalInfo is true --- .../core/service/RepositoryService.scala | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/main/scala/gitbucket/core/service/RepositoryService.scala b/src/main/scala/gitbucket/core/service/RepositoryService.scala index 3640f1c68..0cc3a3b7e 100644 --- a/src/main/scala/gitbucket/core/service/RepositoryService.scala +++ b/src/main/scala/gitbucket/core/service/RepositoryService.scala @@ -300,7 +300,7 @@ trait RepositoryService { self: AccountService => case None => Repositories filter(_.isPrivate === false.bind) }).filter { t => repositoryUserName.map { userName => t.userName === userName.bind } getOrElse LiteralColumn(true) - }.sortBy(_.lastActivityDate desc).list.map{ repository => + }.sortBy(_.lastActivityDate desc).list.map { repository => new RepositoryInfo( if(withoutPhysicalInfo){ new JGitUtil.RepositoryInfo(repository.userName, repository.repositoryName) @@ -308,11 +308,19 @@ trait RepositoryService { self: AccountService => JGitUtil.getRepositoryInfo(repository.userName, repository.repositoryName) }, repository, - getForkedCount( - repository.originUserName.getOrElse(repository.userName), - repository.originRepositoryName.getOrElse(repository.repositoryName) - ), - getRepositoryManagers(repository.userName)) + if(withoutPhysicalInfo){ + -1 + } else { + getForkedCount( + repository.originUserName.getOrElse(repository.userName), + repository.originRepositoryName.getOrElse(repository.repositoryName) + ) + }, + if(withoutPhysicalInfo) { + Nil + } else { + getRepositoryManagers(repository.userName) + }) } } From 0f0c3c1b1daf904aa988520fe44e7c6c882bb9ea Mon Sep 17 00:00:00 2001 From: motohacy Date: Tue, 18 Apr 2017 17:24:07 +0900 Subject: [PATCH 38/52] dropdown-menu become scrollable dropdown-menu become scrollable. --- src/main/webapp/assets/common/css/gitbucket.css | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/webapp/assets/common/css/gitbucket.css b/src/main/webapp/assets/common/css/gitbucket.css index 45e4f1013..337b989ad 100644 --- a/src/main/webapp/assets/common/css/gitbucket.css +++ b/src/main/webapp/assets/common/css/gitbucket.css @@ -342,6 +342,8 @@ div.account-image { ul.dropdown-menu { padding: 2px 0; + overflow: auto; + max-height: 100vh; } ul.dropdown-menu li { From 9c078971abc9212c279df70c77db2a736d9b21a2 Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Tue, 18 Apr 2017 18:42:56 +0900 Subject: [PATCH 39/52] Don't retrieve unused repository information when withoutPhysicalInfo is true --- .../core/controller/IndexController.scala | 16 ++++++++-------- .../core/service/RepositoryService.scala | 18 +++++++++++++----- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/main/scala/gitbucket/core/controller/IndexController.scala b/src/main/scala/gitbucket/core/controller/IndexController.scala index 9d0316fa5..524f26fad 100644 --- a/src/main/scala/gitbucket/core/controller/IndexController.scala +++ b/src/main/scala/gitbucket/core/controller/IndexController.scala @@ -26,13 +26,13 @@ trait IndexControllerBase extends ControllerBase { "password" -> trim(label("Password", text(required))) )(SignInForm.apply) - val searchForm = mapping( - "query" -> trim(text(required)), - "owner" -> trim(text(required)), - "repository" -> trim(text(required)) - )(SearchForm.apply) - - case class SearchForm(query: String, owner: String, repository: String) +// val searchForm = mapping( +// "query" -> trim(text(required)), +// "owner" -> trim(text(required)), +// "repository" -> trim(text(required)) +// )(SearchForm.apply) +// +// case class SearchForm(query: String, owner: String, repository: String) get("/"){ @@ -163,7 +163,7 @@ trait IndexControllerBase extends ControllerBase { get("/search"){ val query = params.getOrElse("query", "").trim.toLowerCase - val visibleRepositories = getVisibleRepositories(context.loginAccount, None) + val visibleRepositories = getVisibleRepositories(context.loginAccount, repositoryUserName = None, withoutPhysicalInfo = true) val repositories = visibleRepositories.filter { repository => repository.name.toLowerCase.indexOf(query) >= 0 || repository.owner.toLowerCase.indexOf(query) >= 0 } diff --git a/src/main/scala/gitbucket/core/service/RepositoryService.scala b/src/main/scala/gitbucket/core/service/RepositoryService.scala index 0cc3a3b7e..358083385 100644 --- a/src/main/scala/gitbucket/core/service/RepositoryService.scala +++ b/src/main/scala/gitbucket/core/service/RepositoryService.scala @@ -262,11 +262,19 @@ trait RepositoryService { self: AccountService => JGitUtil.getRepositoryInfo(repository.userName, repository.repositoryName) }, repository, - getForkedCount( - repository.originUserName.getOrElse(repository.userName), - repository.originRepositoryName.getOrElse(repository.repositoryName) - ), - getRepositoryManagers(repository.userName)) + if(withoutPhysicalInfo){ + -1 + } else { + getForkedCount( + repository.originUserName.getOrElse(repository.userName), + repository.originRepositoryName.getOrElse(repository.repositoryName) + ) + }, + if(withoutPhysicalInfo){ + Nil + } else { + getRepositoryManagers(repository.userName) + }) } } From c6449d4c101ef06685b56326182f4aa891ad4623 Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Wed, 19 Apr 2017 10:30:11 +0200 Subject: [PATCH 40/52] Scala 2.12.2 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index b7c12bce3..e1faf5dad 100644 --- a/build.sbt +++ b/build.sbt @@ -10,7 +10,7 @@ sourcesInBase := false organization := Organization name := Name version := GitBucketVersion -scalaVersion := "2.12.1" +scalaVersion := "2.12.2" // dependency settings resolvers ++= Seq( From 37303a8c5a54939d1c1d46722c07b401e8d0c83d Mon Sep 17 00:00:00 2001 From: YT Date: Wed, 19 Apr 2017 20:19:03 +0900 Subject: [PATCH 41/52] make dir in archive --- .../core/controller/RepositoryViewerController.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala b/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala index 81579f559..6fc90d7e9 100644 --- a/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala +++ b/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala @@ -675,8 +675,8 @@ trait RepositoryViewerControllerBase extends ControllerBase { val oid = git.getRepository.resolve(revision) val revCommit = JGitUtil.getRevCommitFromId(git, oid) val sha1 = oid.getName() - val filename = repository.name + "-" + - (if(sha1.startsWith(revision)) sha1 else revision).replace('/','-') + suffix + val repositorySuffix = (if(sha1.startsWith(revision)) sha1 else revision).replace('/','-') + val filename = repository.name + "-" + repositorySuffix + suffix contentType = "application/octet-stream" response.setHeader("Content-Disposition", s"attachment; filename=${filename}") @@ -684,6 +684,7 @@ trait RepositoryViewerControllerBase extends ControllerBase { git.archive .setFormat(suffix.tail) + .setPrefix(repository.name + "-" + repositorySuffix + "/") .setTree(revCommit) .setOutputStream(response.getOutputStream) .call() From 788e56d9260800d49ab471fe110e99d5a4365bb9 Mon Sep 17 00:00:00 2001 From: KOUNOIKE Yuusuke Date: Wed, 19 Apr 2017 20:46:52 +0900 Subject: [PATCH 42/52] Fix #1525 move attached directory when rename/transfer repo. --- .../controller/RepositorySettingsController.scala | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/scala/gitbucket/core/controller/RepositorySettingsController.scala b/src/main/scala/gitbucket/core/controller/RepositorySettingsController.scala index c6f580f9e..dc40df692 100644 --- a/src/main/scala/gitbucket/core/controller/RepositorySettingsController.scala +++ b/src/main/scala/gitbucket/core/controller/RepositorySettingsController.scala @@ -139,6 +139,12 @@ trait RepositorySettingsControllerBase extends ControllerBase { FileUtils.moveDirectory(dir, getLfsDir(repository.owner, form.repositoryName)) } } + // Move attached directory + defining(getAttachedDir(repository.owner, repository.name)){ dir => + if(dir.isDirectory) { + FileUtils.moveDirectory(dir, getAttachedDir(repository.owner, form.repositoryName)) + } + } // Delete parent directory FileUtil.deleteDirectoryIfEmpty(getRepositoryFilesDir(repository.owner, repository.name)) @@ -352,6 +358,12 @@ trait RepositorySettingsControllerBase extends ControllerBase { FileUtils.moveDirectory(dir, getLfsDir(form.newOwner, repository.name)) } } + // Move attached directory + defining(getAttachedDir(repository.owner, repository.name)){ dir => + if(dir.isDirectory) { + FileUtils.moveDirectory(dir, getAttachedDir(form.newOwner, repository.name)) + } + } // Delere parent directory FileUtil.deleteDirectoryIfEmpty(getRepositoryFilesDir(repository.owner, repository.name)) From 3af89a789785a69d340d81b3efc0cbca913bbb72 Mon Sep 17 00:00:00 2001 From: YT Date: Thu, 20 Apr 2017 20:26:45 +0900 Subject: [PATCH 43/52] modify branch filter method --- src/main/twirl/gitbucket/core/helper/branchcontrol.scala.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/twirl/gitbucket/core/helper/branchcontrol.scala.html b/src/main/twirl/gitbucket/core/helper/branchcontrol.scala.html index 09e3febf1..4d3c673b1 100644 --- a/src/main/twirl/gitbucket/core/helper/branchcontrol.scala.html +++ b/src/main/twirl/gitbucket/core/helper/branchcontrol.scala.html @@ -31,7 +31,7 @@ $('#branch-control-input').keyup(function() { var inputVal = $('#branch-control-input').val(); $.each($('#branch-control-input').parent().parent().find('a'), function(index, elem) { - if (!inputVal || !elem.text.trim() || elem.text.trim().lastIndexOf(inputVal, 0) >= 0) { + if (!inputVal || !elem.text.trim() || elem.text.trim().match(new RegExp(inputVal,'i'))) { $(elem).parent().show(); } else { $(elem).parent().hide(); From 6128258cfb1529f58d3f66ba620846861a052bad Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Sun, 23 Apr 2017 23:32:12 +0900 Subject: [PATCH 44/52] Bump to 4.12.0 --- build.sbt | 2 +- src/main/scala/gitbucket/core/GitBucketCoreModule.scala | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index e1faf5dad..5333c2910 100644 --- a/build.sbt +++ b/build.sbt @@ -1,6 +1,6 @@ val Organization = "io.github.gitbucket" val Name = "gitbucket" -val GitBucketVersion = "4.11.0" +val GitBucketVersion = "4.12.0" val ScalatraVersion = "2.5.0" val JettyVersion = "9.3.9.v20160517" diff --git a/src/main/scala/gitbucket/core/GitBucketCoreModule.scala b/src/main/scala/gitbucket/core/GitBucketCoreModule.scala index dd8665d55..b33a90941 100644 --- a/src/main/scala/gitbucket/core/GitBucketCoreModule.scala +++ b/src/main/scala/gitbucket/core/GitBucketCoreModule.scala @@ -31,5 +31,6 @@ object GitBucketCoreModule extends Module("gitbucket-core", new Version("4.10.0"), new Version("4.11.0", new LiquibaseMigration("update/gitbucket-core_4.11.xml") - ) + ), + new Version("4.12.0") ) From 7010b316fdece4e34fbbe17b8fd07d9725620304 Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Tue, 25 Apr 2017 09:32:13 +0900 Subject: [PATCH 45/52] (refs #1551)Fix validation for repository name --- .../core/controller/RepositorySettingsController.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/scala/gitbucket/core/controller/RepositorySettingsController.scala b/src/main/scala/gitbucket/core/controller/RepositorySettingsController.scala index dc40df692..4fc7974f2 100644 --- a/src/main/scala/gitbucket/core/controller/RepositorySettingsController.scala +++ b/src/main/scala/gitbucket/core/controller/RepositorySettingsController.scala @@ -40,7 +40,7 @@ trait RepositorySettingsControllerBase extends ControllerBase { ) val optionsForm = mapping( - "repositoryName" -> trim(label("Repository Name" , text(required, maxlength(100), identifier, renameRepositoryName))), + "repositoryName" -> trim(label("Repository Name" , text(required, maxlength(100), repository, renameRepositoryName))), "description" -> trim(label("Description" , optional(text()))), "isPrivate" -> trim(label("Repository Type" , boolean())), "issuesOption" -> trim(label("Issues Option" , text(required, featureOption))), From 5337b29532cdd24b1dcbeebac66784da3a3ea385 Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Tue, 25 Apr 2017 09:41:42 +0900 Subject: [PATCH 46/52] Disable dock icon --- src/main/java/JettyLauncher.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/JettyLauncher.java b/src/main/java/JettyLauncher.java index bae7ae13e..04ae950c6 100644 --- a/src/main/java/JettyLauncher.java +++ b/src/main/java/JettyLauncher.java @@ -8,6 +8,8 @@ import java.security.ProtectionDomain; public class JettyLauncher { public static void main(String[] args) throws Exception { + System.setProperty("java.awt.headless", "true"); + String host = null; int port = 8080; InetSocketAddress address = null; From f46f5909f1b6fc46bf70a5f170ddaab31ef6725c Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Tue, 25 Apr 2017 13:53:50 +0900 Subject: [PATCH 47/52] (refs #1554)Enable DB session for plugin git repo authentication --- .../servlet/GitAuthenticationFilter.scala | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/scala/gitbucket/core/servlet/GitAuthenticationFilter.scala b/src/main/scala/gitbucket/core/servlet/GitAuthenticationFilter.scala index 7e0ba9797..2947fde64 100644 --- a/src/main/scala/gitbucket/core/servlet/GitAuthenticationFilter.scala +++ b/src/main/scala/gitbucket/core/servlet/GitAuthenticationFilter.scala @@ -51,21 +51,21 @@ class GitAuthenticationFilter extends Filter with RepositoryService with Account private def pluginRepository(request: HttpServletRequest, response: HttpServletResponse, chain: FilterChain, settings: SystemSettings, isUpdating: Boolean, filter: GitRepositoryFilter): Unit = { - implicit val r = request + Database() withSession { implicit session => + val account = for { + auth <- Option(request.getHeader("Authorization")) + Array(username, password) = AuthUtil.decodeAuthHeader(auth).split(":", 2) + account <- authenticate(settings, username, password) + } yield { + request.setAttribute(Keys.Request.UserName, account.userName) + account + } - val account = for { - auth <- Option(request.getHeader("Authorization")) - Array(username, password) = AuthUtil.decodeAuthHeader(auth).split(":", 2) - account <- authenticate(settings, username, password) - } yield { - request.setAttribute(Keys.Request.UserName, account.userName) - account - } - - if(filter.filter(request.gitRepositoryPath, account.map(_.userName), settings, isUpdating)){ - chain.doFilter(request, response) - } else { - AuthUtil.requireAuth(response) + if (filter.filter(request.gitRepositoryPath, account.map(_.userName), settings, isUpdating)) { + chain.doFilter(request, response) + } else { + AuthUtil.requireAuth(response) + } } } From 8b4017a082438e56bb20e87fbc0ad503dc2966f9 Mon Sep 17 00:00:00 2001 From: Yasuhiro Takagi Date: Wed, 26 Apr 2017 21:22:46 +0900 Subject: [PATCH 48/52] dropdown menu filter in compare page filter applied "base fork:" "base:" "head fork:" "compare:" menus. --- .../gitbucket/core/pulls/compare.scala.html | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/main/twirl/gitbucket/core/pulls/compare.scala.html b/src/main/twirl/gitbucket/core/pulls/compare.scala.html index d390c17a2..417717787 100644 --- a/src/main/twirl/gitbucket/core/pulls/compare.scala.html +++ b/src/main/twirl/gitbucket/core/pulls/compare.scala.html @@ -221,3 +221,26 @@ $(function(){ } }); + + From 46896da46e77f5e03a4d907be6f1ada07cb02a36 Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Fri, 28 Apr 2017 08:26:50 +0900 Subject: [PATCH 49/52] Fix to avoid regular expression error in the filter box --- src/main/twirl/gitbucket/core/pulls/compare.scala.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/twirl/gitbucket/core/pulls/compare.scala.html b/src/main/twirl/gitbucket/core/pulls/compare.scala.html index 417717787..17a399a85 100644 --- a/src/main/twirl/gitbucket/core/pulls/compare.scala.html +++ b/src/main/twirl/gitbucket/core/pulls/compare.scala.html @@ -223,11 +223,12 @@ $(function(){