mirror of
https://github.com/gitbucket/gitbucket.git
synced 2026-05-09 03:26:43 +02:00
Compare commits
54 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
80b50f6fa9 | ||
|
|
7cd47a714b | ||
|
|
b1d46ce2e5 | ||
|
|
ecdb2b3eb5 | ||
|
|
dde3738c45 | ||
|
|
2e69959a1f | ||
|
|
28c5f6e434 | ||
|
|
1b165fd230 | ||
|
|
96f8716417 | ||
|
|
7353da674d | ||
|
|
dbb25c95cd | ||
|
|
126a3465d6 | ||
|
|
6061f70e24 | ||
|
|
ec569839fe | ||
|
|
fd0bc80284 | ||
|
|
318cdafcb1 | ||
|
|
1e9b60446f | ||
|
|
35216d8a47 | ||
|
|
4aa90c0501 | ||
|
|
7965408960 | ||
|
|
10c6660f23 | ||
|
|
e391688a45 | ||
|
|
8445f210ee | ||
|
|
c268ad46ce | ||
|
|
1a8f476a81 | ||
|
|
22d8fdd81a | ||
|
|
ae947cd436 | ||
|
|
b70a46114c | ||
|
|
126cc16977 | ||
|
|
a72ca0dc53 | ||
|
|
a914b32fe7 | ||
|
|
5d344c33cc | ||
|
|
82564cecb0 | ||
|
|
fb5012f851 | ||
|
|
067a4856f4 | ||
|
|
a22afc2fa8 | ||
|
|
0e7ce02e4e | ||
|
|
b13fc2b4e7 | ||
|
|
b5322186ab | ||
|
|
09f85da1de | ||
|
|
775f838110 | ||
|
|
123cab6c19 | ||
|
|
4cb04e9cc3 | ||
|
|
4aa2727676 | ||
|
|
8dea7302a3 | ||
|
|
04823666b6 | ||
|
|
ed9d4443ae | ||
|
|
45a1af2cd7 | ||
|
|
cb920feb24 | ||
|
|
16097bff94 | ||
|
|
c159b704b6 | ||
|
|
3920dfb57e | ||
|
|
31345cc739 | ||
|
|
3ebc4e8e23 |
@@ -2,6 +2,7 @@ language: scala
|
||||
sudo: true
|
||||
jdk:
|
||||
- oraclejdk8
|
||||
- oraclejdk11
|
||||
script:
|
||||
- sbt scalafmtSbtCheck scalafmtCheck test:scalafmtCheck test
|
||||
before_script:
|
||||
|
||||
12
CHANGELOG.md
12
CHANGELOG.md
@@ -1,10 +1,22 @@
|
||||
# Changelog
|
||||
All changes to the project will be documented in this file.
|
||||
|
||||
### 4.29.0 - 29 Sep 2018
|
||||
- Official Docker image has been available
|
||||
- Enhance file edit and delete buttons of the repository viewer
|
||||
- Fix Patch button to generate patches for all files in the commit
|
||||
- Display confirmation dialog for Transfer Ownership and Garbage collection
|
||||
- Fix wrong url encoding in "Compare & pull request"
|
||||
|
||||
### 4.28.0 - 1 Sep 2018
|
||||
- Proxy support for plugin installation
|
||||
- Fix some bugs around pull requests
|
||||
|
||||
### 4.27.0 - 29 Jul 2018
|
||||
- Create new tag on the browser
|
||||
- EditorConfig support
|
||||
- Improve issues / pull requests search
|
||||
- Some improvements and bug fixes for plugin installation via internet and pull request commenting
|
||||
|
||||
### 4.26.0 - 30 Jun 2018
|
||||
- Installing plugins from the central registry
|
||||
|
||||
14
README.md
14
README.md
@@ -1,4 +1,4 @@
|
||||
GitBucket [](https://gitter.im/gitbucket/gitbucket) [](https://travis-ci.org/gitbucket/gitbucket) [](https://maven-badges.herokuapp.com/maven-central/io.github.gitbucket/gitbucket_2.12) [](https://github.com/gitbucket/gitbucket/blob/master/LICENSE)
|
||||
GitBucket [](https://gitter.im/gitbucket/gitbucket) [](https://travis-ci.org/gitbucket/gitbucket) [](https://maven-badges.herokuapp.com/maven-central/io.github.gitbucket/gitbucket_2.12) [](https://github.com/gitbucket/gitbucket/blob/master/LICENSE)
|
||||
=========
|
||||
|
||||
GitBucket is a Git web platform powered by Scala offering:
|
||||
@@ -68,11 +68,13 @@ Support
|
||||
- If you can't find same question and report, send it to [gitter room](https://gitter.im/gitbucket/gitbucket) before raising an issue.
|
||||
- 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.
|
||||
|
||||
What's New in 4.27.x
|
||||
What's New in 4.29.x
|
||||
-------------
|
||||
### 4.27.0 - 29 Jul 2018
|
||||
- Create new tag on the browser
|
||||
- EditorConfig support
|
||||
- Improve issues / pull requests search
|
||||
### 4.29.0 - 29 Sep 2018
|
||||
- Official Docker image has been available
|
||||
- Enhance file edit and delete buttons of the repository viewer
|
||||
- Fix Patch button to generate patches for all files in the commit
|
||||
- Display confirmation dialog for Transfer Ownership and Garbage collection
|
||||
- Fix wrong url encoding in "Compare & pull request"
|
||||
|
||||
See the [change log](CHANGELOG.md) for all of the updates.
|
||||
|
||||
15
build.sbt
15
build.sbt
@@ -3,9 +3,10 @@ import com.typesafe.sbt.pgp.PgpKeys._
|
||||
|
||||
val Organization = "io.github.gitbucket"
|
||||
val Name = "gitbucket"
|
||||
val GitBucketVersion = "4.27.0"
|
||||
val ScalatraVersion = "2.6.1"
|
||||
val JettyVersion = "9.4.7.v20170914"
|
||||
val GitBucketVersion = "4.29.0"
|
||||
val ScalatraVersion = "2.6.3"
|
||||
val JettyVersion = "9.4.11.v20180605"
|
||||
val JgitVersion = "5.1.1.201809181055-r"
|
||||
|
||||
lazy val root = (project in file("."))
|
||||
.enablePlugins(SbtTwirl, ScalatraPlugin)
|
||||
@@ -16,7 +17,7 @@ sourcesInBase := false
|
||||
organization := Organization
|
||||
name := Name
|
||||
version := GitBucketVersion
|
||||
scalaVersion := "2.12.6"
|
||||
scalaVersion := "2.12.7"
|
||||
|
||||
scalafmtOnCompile := true
|
||||
|
||||
@@ -30,8 +31,8 @@ resolvers ++= Seq(
|
||||
)
|
||||
|
||||
libraryDependencies ++= Seq(
|
||||
"org.eclipse.jgit" % "org.eclipse.jgit.http.server" % "5.0.1.201806211838-r",
|
||||
"org.eclipse.jgit" % "org.eclipse.jgit.archive" % "5.0.1.201806211838-r",
|
||||
"org.eclipse.jgit" % "org.eclipse.jgit.http.server" % JgitVersion,
|
||||
"org.eclipse.jgit" % "org.eclipse.jgit.archive" % JgitVersion,
|
||||
"org.scalatra" %% "scalatra" % ScalatraVersion,
|
||||
"org.scalatra" %% "scalatra-json" % ScalatraVersion,
|
||||
"org.scalatra" %% "scalatra-forms" % ScalatraVersion,
|
||||
@@ -64,7 +65,7 @@ libraryDependencies ++= Seq(
|
||||
"javax.servlet" % "javax.servlet-api" % "3.1.0" % "provided",
|
||||
"junit" % "junit" % "4.12" % "test",
|
||||
"org.scalatra" %% "scalatra-scalatest" % ScalatraVersion % "test",
|
||||
"org.mockito" % "mockito-core" % "2.13.0" % "test",
|
||||
"org.mockito" % "mockito-core" % "2.19.1" % "test",
|
||||
"com.wix" % "wix-embedded-mysql" % "3.0.0" % "test",
|
||||
"ru.yandex.qatools.embed" % "postgresql-embedded" % "2.6" % "test",
|
||||
"net.i2p.crypto" % "eddsa" % "0.2.0",
|
||||
|
||||
@@ -1 +1 @@
|
||||
sbt.version=1.1.6
|
||||
sbt.version=1.2.3
|
||||
|
||||
@@ -56,5 +56,7 @@ object GitBucketCoreModule
|
||||
new Version("4.24.1"),
|
||||
new Version("4.25.0", new LiquibaseMigration("update/gitbucket-core_4.25.xml")),
|
||||
new Version("4.26.0"),
|
||||
new Version("4.27.0", new LiquibaseMigration("update/gitbucket-core_4.27.xml"))
|
||||
new Version("4.27.0", new LiquibaseMigration("update/gitbucket-core_4.27.xml")),
|
||||
new Version("4.28.0"),
|
||||
new Version("4.29.0")
|
||||
)
|
||||
|
||||
@@ -256,9 +256,9 @@ trait ApiControllerBase extends ControllerBase {
|
||||
} else {
|
||||
val refs = git
|
||||
.getRepository()
|
||||
.getAllRefs()
|
||||
.getRefDatabase()
|
||||
.getRefsByPrefix("refs/")
|
||||
.asScala
|
||||
.collect { case (str, ref) if str.startsWith("refs/" + revstr) => ref }
|
||||
|
||||
JsonFormat(refs.map { ref =>
|
||||
val sha = ref.getObjectId().name()
|
||||
@@ -352,7 +352,9 @@ trait ApiControllerBase extends ControllerBase {
|
||||
data.auto_init
|
||||
)
|
||||
Await.result(f, Duration.Inf)
|
||||
val repository = getRepository(groupName, data.name).get
|
||||
val repository = Database() withTransaction { session =>
|
||||
getRepository(groupName, data.name).get
|
||||
}
|
||||
JsonFormat(ApiRepository(repository, ApiUser(getAccountByUserName(groupName).get)))
|
||||
} else {
|
||||
ApiError(
|
||||
|
||||
@@ -642,7 +642,7 @@ trait PullRequestsControllerBase extends ControllerBase {
|
||||
case _ =>
|
||||
forkedRepository.repository :: getForkedRepositories(forkedRepository.owner, forkedRepository.name)
|
||||
}).map { repository =>
|
||||
(repository.userName, repository.repositoryName)
|
||||
(repository.userName, repository.repositoryName, repository.defaultBranch)
|
||||
},
|
||||
commits.flatten
|
||||
.map(commit => getCommitComments(forkedRepository.owner, forkedRepository.name, commit.id, false))
|
||||
|
||||
@@ -94,9 +94,16 @@ trait SystemSettingsControllerBase extends AccountManagementControllerBase {
|
||||
),
|
||||
"skinName" -> trim(label("AdminLTE skin name", text(required))),
|
||||
"showMailAddress" -> trim(label("Show mail address", boolean())),
|
||||
"pluginNetworkInstall" -> new SingleValueType[Boolean] {
|
||||
override def convert(value: String, messages: Messages): Boolean = context.settings.pluginNetworkInstall
|
||||
}
|
||||
"pluginNetworkInstall" -> trim(label("Network plugin installation", boolean())),
|
||||
"proxy" -> optionalIfNotChecked(
|
||||
"useProxy",
|
||||
mapping(
|
||||
"host" -> trim(label("Proxy host", text(required))),
|
||||
"port" -> trim(label("Proxy port", number())),
|
||||
"user" -> trim(label("Keystore", optional(text()))),
|
||||
"password" -> trim(label("Keystore", optional(text())))
|
||||
)(Proxy.apply)
|
||||
)
|
||||
)(SystemSettings.apply).verifying { settings =>
|
||||
Vector(
|
||||
if (settings.ssh.enabled && settings.baseUrl.isEmpty) {
|
||||
@@ -380,11 +387,6 @@ trait SystemSettingsControllerBase extends AccountManagementControllerBase {
|
||||
})
|
||||
|
||||
post("/admin/plugins/_reload")(adminOnly {
|
||||
// Update configuration
|
||||
val pluginNetworkInstall = params.get("pluginNetworkInstall").map(_.toBoolean).getOrElse(false)
|
||||
saveSystemSettings(context.settings.copy(pluginNetworkInstall = pluginNetworkInstall))
|
||||
|
||||
// Reload plugins
|
||||
PluginRegistry.reload(request.getServletContext(), loadSystemSettings(), request2Session(request).conn)
|
||||
flash += "info" -> "All plugins were reloaded."
|
||||
redirect("/admin/plugins")
|
||||
|
||||
@@ -6,8 +6,8 @@ import java.nio.file.{Files, Paths, StandardWatchEventKinds}
|
||||
import java.util.Base64
|
||||
import java.util.concurrent.ConcurrentLinkedQueue
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import javax.servlet.ServletContext
|
||||
|
||||
import javax.servlet.ServletContext
|
||||
import com.github.zafarkhaja.semver.Version
|
||||
import gitbucket.core.controller.{Context, ControllerBase}
|
||||
import gitbucket.core.model.{Account, Issue}
|
||||
@@ -18,10 +18,12 @@ import gitbucket.core.service.SystemSettingsService.SystemSettings
|
||||
import gitbucket.core.util.SyntaxSugars._
|
||||
import gitbucket.core.util.DatabaseConfig
|
||||
import gitbucket.core.util.Directory._
|
||||
import gitbucket.core.util.HttpClientUtil._
|
||||
import io.github.gitbucket.solidbase.Solidbase
|
||||
import io.github.gitbucket.solidbase.manager.JDBCVersionManager
|
||||
import io.github.gitbucket.solidbase.model.Module
|
||||
import org.apache.commons.io.FileUtils
|
||||
import org.apache.http.client.methods.HttpGet
|
||||
import org.apache.sshd.server.Command
|
||||
import org.slf4j.LoggerFactory
|
||||
import play.twirl.api.Html
|
||||
@@ -253,8 +255,17 @@ object PluginRegistry {
|
||||
})
|
||||
.foreach(_.delete())
|
||||
|
||||
val in = url.openStream()
|
||||
FileUtils.copyToFile(in, new File(PluginHome, new File(url.getFile).getName))
|
||||
withHttpClient(settings.pluginProxy) { httpClient =>
|
||||
val httpGet = new HttpGet(url.toString)
|
||||
try {
|
||||
val response = httpClient.execute(httpGet)
|
||||
val in = response.getEntity.getContent
|
||||
FileUtils.copyToFile(in, new File(PluginHome, new File(url.getFile).getName))
|
||||
} finally {
|
||||
httpGet.releaseConnection()
|
||||
}
|
||||
}
|
||||
|
||||
instance = new PluginRegistry()
|
||||
initialize(context, settings, conn)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package gitbucket.core.plugin
|
||||
|
||||
import gitbucket.core.controller.Context
|
||||
import gitbucket.core.util.SyntaxSugars.using
|
||||
import gitbucket.core.util.HttpClientUtil._
|
||||
import org.json4s._
|
||||
import org.apache.commons.io.IOUtils
|
||||
|
||||
import org.apache.http.client.methods.HttpGet
|
||||
import org.slf4j.LoggerFactory
|
||||
|
||||
object PluginRepository {
|
||||
@@ -12,18 +17,28 @@ object PluginRepository {
|
||||
org.json4s.jackson.JsonMethods.parse(json).extract[Seq[PluginMetadata]]
|
||||
}
|
||||
|
||||
def getPlugins(): Seq[PluginMetadata] = {
|
||||
def getPlugins()(implicit context: Context): Seq[PluginMetadata] = {
|
||||
try {
|
||||
val url = new java.net.URL("https://plugins.gitbucket-community.org/releases/plugins.json")
|
||||
val str = IOUtils.toString(url, "UTF-8")
|
||||
parsePluginJson(str)
|
||||
|
||||
withHttpClient(context.settings.pluginProxy) { httpClient =>
|
||||
val httpGet = new HttpGet(url.toString)
|
||||
try {
|
||||
val response = httpClient.execute(httpGet)
|
||||
using(response.getEntity.getContent) { in =>
|
||||
val str = IOUtils.toString(in, "UTF-8")
|
||||
parsePluginJson(str)
|
||||
}
|
||||
} finally {
|
||||
httpGet.releaseConnection()
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
case t: Throwable =>
|
||||
logger.warn("Failed to access to the plugin repository: " + t.toString)
|
||||
Nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Mapped from plugins.json
|
||||
|
||||
@@ -351,9 +351,11 @@ trait IssuesService {
|
||||
implicit s: Session
|
||||
) =
|
||||
Issues filter { t1 =>
|
||||
repos
|
||||
.map { case (owner, repository) => t1.byRepository(owner, repository) }
|
||||
.foldLeft[Rep[Boolean]](false)(_ || _) &&
|
||||
(if (repos.size == 1) {
|
||||
t1.byRepository(repos.head._1, repos.head._2)
|
||||
} else {
|
||||
((t1.userName ++ "/" ++ t1.repositoryName) inSetBind (repos.map { case (owner, repo) => s"$owner/$repo" }))
|
||||
}) &&
|
||||
(t1.closed === (condition.state == "closed").bind) &&
|
||||
(t1.milestoneId.? isEmpty, condition.milestone == Some(None)) &&
|
||||
(t1.priorityId.? isEmpty, condition.priority == Some(None)) &&
|
||||
|
||||
@@ -70,6 +70,16 @@ trait SystemSettingsService {
|
||||
props.setProperty(SkinName, settings.skinName.toString)
|
||||
props.setProperty(ShowMailAddress, settings.showMailAddress.toString)
|
||||
props.setProperty(PluginNetworkInstall, settings.pluginNetworkInstall.toString)
|
||||
settings.pluginProxy.foreach { proxy =>
|
||||
props.setProperty(PluginProxyHost, proxy.host)
|
||||
props.setProperty(PluginProxyPort, proxy.port.toString)
|
||||
proxy.user.foreach { user =>
|
||||
props.setProperty(PluginProxyUser, user)
|
||||
}
|
||||
proxy.password.foreach { password =>
|
||||
props.setProperty(PluginProxyPassword, password)
|
||||
}
|
||||
}
|
||||
|
||||
using(new java.io.FileOutputStream(GitBucketConf)) { out =>
|
||||
props.store(out, null)
|
||||
@@ -112,9 +122,7 @@ trait SystemSettingsService {
|
||||
getOptionValue(props, SmtpFromName, None)
|
||||
)
|
||||
)
|
||||
} else {
|
||||
None
|
||||
},
|
||||
} else None,
|
||||
getValue(props, LdapAuthentication, false),
|
||||
if (getValue(props, LdapAuthentication, false)) {
|
||||
Some(
|
||||
@@ -133,9 +141,7 @@ trait SystemSettingsService {
|
||||
getOptionValue(props, LdapKeystore, None)
|
||||
)
|
||||
)
|
||||
} else {
|
||||
None
|
||||
},
|
||||
} else None,
|
||||
getValue(props, OidcAuthentication, false),
|
||||
if (getValue(props, OidcAuthentication, false)) {
|
||||
Some(
|
||||
@@ -151,7 +157,17 @@ trait SystemSettingsService {
|
||||
},
|
||||
getValue(props, SkinName, "skin-blue"),
|
||||
getValue(props, ShowMailAddress, false),
|
||||
getValue(props, PluginNetworkInstall, false)
|
||||
getValue(props, PluginNetworkInstall, false),
|
||||
if (getValue(props, PluginProxyHost, "").nonEmpty) {
|
||||
Some(
|
||||
Proxy(
|
||||
getValue(props, PluginProxyHost, ""),
|
||||
getValue(props, PluginProxyPort, 8080),
|
||||
getOptionValue(props, PluginProxyUser, None),
|
||||
getOptionValue(props, PluginProxyPassword, None)
|
||||
)
|
||||
)
|
||||
} else None
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -181,7 +197,8 @@ object SystemSettingsService {
|
||||
oidc: Option[OIDC],
|
||||
skinName: String,
|
||||
showMailAddress: Boolean,
|
||||
pluginNetworkInstall: Boolean
|
||||
pluginNetworkInstall: Boolean,
|
||||
pluginProxy: Option[Proxy]
|
||||
) {
|
||||
|
||||
def baseUrl(request: HttpServletRequest): String =
|
||||
@@ -249,6 +266,13 @@ object SystemSettingsService {
|
||||
fromName: Option[String]
|
||||
)
|
||||
|
||||
case class Proxy(
|
||||
host: String,
|
||||
port: Int,
|
||||
user: Option[String],
|
||||
password: Option[String],
|
||||
)
|
||||
|
||||
case class SshAddress(host: String, port: Int, genericUser: String)
|
||||
|
||||
case class Lfs(serverUrl: Option[String])
|
||||
@@ -298,6 +322,10 @@ object SystemSettingsService {
|
||||
private val SkinName = "skinName"
|
||||
private val ShowMailAddress = "showMailAddress"
|
||||
private val PluginNetworkInstall = "plugin.networkInstall"
|
||||
private val PluginProxyHost = "plugin.proxy.host"
|
||||
private val PluginProxyPort = "plugin.proxy.port"
|
||||
private val PluginProxyUser = "plugin.proxy.user"
|
||||
private val PluginProxyPassword = "plugin.proxy.password"
|
||||
|
||||
private def getValue[A: ClassTag](props: java.util.Properties, key: String, default: A): A = {
|
||||
getSystemProperty(key).getOrElse(getEnvironmentVariable(key).getOrElse {
|
||||
|
||||
35
src/main/scala/gitbucket/core/util/HttpClientUtil.scala
Normal file
35
src/main/scala/gitbucket/core/util/HttpClientUtil.scala
Normal file
@@ -0,0 +1,35 @@
|
||||
package gitbucket.core.util
|
||||
|
||||
import gitbucket.core.service.SystemSettingsService
|
||||
import org.apache.http.HttpHost
|
||||
import org.apache.http.auth.{AuthScope, UsernamePasswordCredentials}
|
||||
import org.apache.http.impl.client.{BasicCredentialsProvider, CloseableHttpClient, HttpClientBuilder}
|
||||
|
||||
object HttpClientUtil {
|
||||
|
||||
def withHttpClient[T](proxy: Option[SystemSettingsService.Proxy])(f: CloseableHttpClient => T): T = {
|
||||
val builder = HttpClientBuilder.create.useSystemProperties
|
||||
|
||||
proxy.foreach { proxy =>
|
||||
builder.setProxy(new HttpHost(proxy.host, proxy.port))
|
||||
|
||||
for (user <- proxy.user; password <- proxy.password) {
|
||||
val credential = new BasicCredentialsProvider()
|
||||
credential.setCredentials(
|
||||
new AuthScope(proxy.host, proxy.port),
|
||||
new UsernamePasswordCredentials(user, password)
|
||||
)
|
||||
builder.setDefaultCredentialsProvider(credential)
|
||||
}
|
||||
}
|
||||
|
||||
val httpClient = builder.build()
|
||||
|
||||
try {
|
||||
f(httpClient)
|
||||
} finally {
|
||||
httpClient.close()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -613,8 +613,12 @@ object JGitUtil {
|
||||
df.setRepository(git.getRepository)
|
||||
df.setDiffComparator(RawTextComparator.DEFAULT)
|
||||
df.setDetectRenames(true)
|
||||
df.format(getDiffEntries(git, from, to).head)
|
||||
new String(out.toByteArray, "UTF-8")
|
||||
getDiffEntries(git, from, to)
|
||||
.map { entry =>
|
||||
df.format(entry)
|
||||
new String(out.toByteArray, "UTF-8")
|
||||
}
|
||||
.mkString("\n")
|
||||
}
|
||||
|
||||
private def getDiffEntries(git: Git, from: Option[String], to: String): Seq[DiffEntry] = {
|
||||
@@ -740,15 +744,17 @@ object JGitUtil {
|
||||
def getBranchesOfCommit(git: Git, commitId: String): List[String] =
|
||||
using(new RevWalk(git.getRepository)) { revWalk =>
|
||||
defining(revWalk.parseCommit(git.getRepository.resolve(commitId + "^0"))) { commit =>
|
||||
git.getRepository.getAllRefs.entrySet.asScala
|
||||
git.getRepository.getRefDatabase
|
||||
.getRefsByPrefix(Constants.R_HEADS)
|
||||
.asScala
|
||||
.filter { e =>
|
||||
(e.getKey.startsWith(Constants.R_HEADS) && revWalk.isMergedInto(
|
||||
(revWalk.isMergedInto(
|
||||
commit,
|
||||
revWalk.parseCommit(e.getValue.getObjectId)
|
||||
revWalk.parseCommit(e.getObjectId)
|
||||
))
|
||||
}
|
||||
.map { e =>
|
||||
e.getValue.getName.substring(org.eclipse.jgit.lib.Constants.R_HEADS.length)
|
||||
e.getName.substring(Constants.R_HEADS.length)
|
||||
}
|
||||
.toList
|
||||
.sorted
|
||||
@@ -781,15 +787,17 @@ object JGitUtil {
|
||||
def getTagsOfCommit(git: Git, commitId: String): List[String] =
|
||||
using(new RevWalk(git.getRepository)) { revWalk =>
|
||||
defining(revWalk.parseCommit(git.getRepository.resolve(commitId + "^0"))) { commit =>
|
||||
git.getRepository.getAllRefs.entrySet.asScala
|
||||
git.getRepository.getRefDatabase
|
||||
.getRefsByPrefix(Constants.R_TAGS)
|
||||
.asScala
|
||||
.filter { e =>
|
||||
(e.getKey.startsWith(Constants.R_TAGS) && revWalk.isMergedInto(
|
||||
(revWalk.isMergedInto(
|
||||
commit,
|
||||
revWalk.parseCommit(e.getValue.getObjectId)
|
||||
revWalk.parseCommit(e.getObjectId)
|
||||
))
|
||||
}
|
||||
.map { e =>
|
||||
e.getValue.getName.substring(org.eclipse.jgit.lib.Constants.R_TAGS.length)
|
||||
e.getName.substring(Constants.R_TAGS.length)
|
||||
}
|
||||
.toList
|
||||
.sorted
|
||||
|
||||
@@ -127,7 +127,11 @@ object LDAPUtil {
|
||||
private def getSslProvider(): Provider = {
|
||||
val cachedInstance = provider.get()
|
||||
if (cachedInstance == null) {
|
||||
val newInstance = Class.forName("com.sun.net.ssl.internal.ssl.Provider").newInstance().asInstanceOf[Provider]
|
||||
val newInstance = Class
|
||||
.forName("com.sun.net.ssl.internal.ssl.Provider")
|
||||
.getDeclaredConstructor()
|
||||
.newInstance()
|
||||
.asInstanceOf[Provider]
|
||||
provider.compareAndSet(null, newInstance)
|
||||
newInstance
|
||||
} else {
|
||||
|
||||
@@ -3,23 +3,23 @@ package gitbucket.core.view
|
||||
import gitbucket.core.controller.Context
|
||||
import gitbucket.core.service.{RepositoryService, RequestCache}
|
||||
import gitbucket.core.util.Implicits.RichString
|
||||
import gitbucket.core.util.StringUtil
|
||||
|
||||
trait LinkConverter { self: RequestCache =>
|
||||
|
||||
/**
|
||||
* Creates a link to the issue or the pull request from the issue id.
|
||||
*/
|
||||
protected def createIssueLink(repository: RepositoryService.RepositoryInfo, issueId: Int)(
|
||||
protected def createIssueLink(repository: RepositoryService.RepositoryInfo, issueId: Int, title: String)(
|
||||
implicit context: Context
|
||||
): String = {
|
||||
val userName = repository.repository.userName
|
||||
val repositoryName = repository.repository.repositoryName
|
||||
|
||||
getIssue(userName, repositoryName, issueId.toString) match {
|
||||
case Some(issue) if (issue.isPullRequest) =>
|
||||
s"""<a href="${context.path}/${userName}/${repositoryName}/pull/${issueId}">Pull #${issueId}</a>"""
|
||||
case Some(_) =>
|
||||
s"""<a href="${context.path}/${userName}/${repositoryName}/issues/${issueId}">Issue #${issueId}</a>"""
|
||||
case Some(issue) =>
|
||||
s"""<a href="${context.path}/${userName}/${repositoryName}/${if (issue.isPullRequest) "pull" else "issues"}/${issueId}"><strong>${StringUtil
|
||||
.escapeHtml(title)}</strong> #${issueId}</a>"""
|
||||
case None =>
|
||||
s"Unknown #${issueId}"
|
||||
}
|
||||
|
||||
@@ -156,8 +156,10 @@ object helpers extends AvatarImageProvider with LinkConverter with RequestCache
|
||||
/**
|
||||
* Creates a link to the issue or the pull request from the issue id.
|
||||
*/
|
||||
def issueLink(repository: RepositoryService.RepositoryInfo, issueId: Int)(implicit context: Context): Html = {
|
||||
Html(createIssueLink(repository, issueId))
|
||||
def issueLink(repository: RepositoryService.RepositoryInfo, issueId: Int, title: String)(
|
||||
implicit context: Context
|
||||
): Html = {
|
||||
Html(createIssueLink(repository, issueId, title))
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
@gitbucket.core.admin.html.menu("plugins") {
|
||||
@gitbucket.core.helper.html.information(info)
|
||||
<form action="@context.path/admin/plugins/_reload" method="POST" class="pull-right">
|
||||
<input type="checkbox" name="pluginNetworkInstall" id="pluginNetworkInstall" value="true" @if(context.settings.pluginNetworkInstall){checked}>
|
||||
<label for="pluginNetworkInstall">Install plugin from <a href="https://plugins.gitbucket-community.org" target="_blank">plugins.gitbucket-community.org</a></label>
|
||||
<input type="submit" value="Reload plugins" class="btn btn-default">
|
||||
</form>
|
||||
<h1 class="system-settings-title">Plugins</h1>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<ul class="nav nav-tabs fill-width" id="pullreq-tab">
|
||||
<li><a href="#system">System settings</a></li>
|
||||
<li><a href="#authentication">Authentication</a></li>
|
||||
<li><a href="#plugins">Plugins</a></li>
|
||||
</ul>
|
||||
<div class="tab-content fill-width" style="padding-top: 20px;">
|
||||
<div class="tab-pane" id="system">
|
||||
@@ -16,6 +17,9 @@
|
||||
<div class="tab-pane" id="authentication">
|
||||
@settings_authentication(info)
|
||||
</div>
|
||||
<div class="tab-pane" id="plugins">
|
||||
@settings_plugins(info)
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="align-right" style="margin-top: 20px;">
|
||||
@@ -30,6 +34,9 @@ $(function(){
|
||||
if(location.hash == '#authentication'){
|
||||
$('li:has(a[href="#authentication"])').addClass('active');
|
||||
$('div#authentication').addClass('active');
|
||||
} else if(location.hash == '#plugins'){
|
||||
$('li:has(a[href="#plugins"])').addClass('active');
|
||||
$('div#plugins').addClass('active');
|
||||
} else {
|
||||
$('li:has(a[href="#system"])').addClass('active');
|
||||
$('div#system').addClass('active');
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
@(info: Option[Any])(implicit context: gitbucket.core.controller.Context)
|
||||
<label class="strong">Plugin repositories</label>
|
||||
<fieldset>
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" id="pluginNetworkInstall" name="pluginNetworkInstall"@if(context.settings.pluginNetworkInstall){ checked} />
|
||||
<a href="https://plugins.gitbucket-community.org" target="_blank">plugins.gitbucket-community.org</a>
|
||||
</label>
|
||||
</fieldset>
|
||||
<hr>
|
||||
<fieldset>
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" id="useProxy" name="useProxy"@if(context.settings.pluginProxy.isDefined){ checked} />
|
||||
Use proxy
|
||||
</label>
|
||||
</fieldset>
|
||||
<div class="proxy">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-2" for="proxyHost">Proxy host</label>
|
||||
<div class="col-md-10">
|
||||
<input type="text" id="proxyHost" name="proxy.host" class="form-control" value="@context.settings.pluginProxy.map(_.host)"/>
|
||||
<span id="error-proxy_host" class="error"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-2" for="proxyPort">Proxy port</label>
|
||||
<div class="col-md-10">
|
||||
<input type="text" id="proxyPort" name="proxy.port" class="form-control input-mini" value="@context.settings.pluginProxy.map(_.port)"/>
|
||||
<span id="error-proxy_port" class="error"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-2" for="proxyUser">Proxy user</label>
|
||||
<div class="col-md-10">
|
||||
<input type="text" id="proxyUser" name="proxy.user" class="form-control" value="@context.settings.pluginProxy.map(_.user)"/>
|
||||
<span id="error-proxy_user" class="error"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-2" for="proxyPassword">Proxy password</label>
|
||||
<div class="col-md-10">
|
||||
<input type="password" id="proxyPassword" name="proxy.password" class="form-control" value="@context.settings.pluginProxy.map(_.password)"/>
|
||||
<span id="error-proxy_password" class="error"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function(){
|
||||
$('#useProxy').change(function(){
|
||||
$('.proxy input').prop('disabled', !$(this).prop('checked'));
|
||||
}).change();
|
||||
});
|
||||
</script>
|
||||
@@ -112,7 +112,7 @@
|
||||
</div>
|
||||
<div style="discussion-item-content">
|
||||
@defining(comment.content.split(":")){ case Array(issueId, rest @ _*) =>
|
||||
<strong>@helpers.issueLink(repository, issueId.toInt): @rest.mkString(":")</strong>
|
||||
@helpers.issueLink(repository, issueId.toInt, rest.mkString(":"))
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
@(title: String,
|
||||
commits: Seq[Seq[gitbucket.core.util.JGitUtil.CommitInfo]],
|
||||
diffs: Seq[gitbucket.core.util.JGitUtil.DiffInfo],
|
||||
members: List[(String, String)],
|
||||
members: List[(String, String, String)],
|
||||
comments: List[gitbucket.core.model.Comment],
|
||||
originId: String,
|
||||
forkedId: String,
|
||||
@@ -22,8 +22,8 @@
|
||||
<div class="pullreq-info">
|
||||
<div id="compare-edit">
|
||||
@gitbucket.core.helper.html.dropdown(originRepository.owner + "/" + originRepository.name, "base fork", filter=("origin_repo", "Find Repository...")) {
|
||||
@members.map { case (owner, name) =>
|
||||
<li><a href="#" class="origin-owner" data-owner="@owner" data-name="@name">@gitbucket.core.helper.html.checkicon(owner == originRepository.owner) @owner/@name</a></li>
|
||||
@members.map { case (owner, name, defaultBranch) =>
|
||||
<li><a href="#" class="origin-owner" data-owner="@owner" data-name="@name" data-default-branch="@defaultBranch">@gitbucket.core.helper.html.checkicon(owner == originRepository.owner) @owner/@name</a></li>
|
||||
}
|
||||
}
|
||||
@gitbucket.core.helper.html.dropdown(originId, "base", filter=("origin_branch", "Find Branch...")) {
|
||||
@@ -33,8 +33,8 @@
|
||||
}
|
||||
...
|
||||
@gitbucket.core.helper.html.dropdown(forkedRepository.owner + "/" + forkedRepository.name, "head fork", filter=("forked_repo", "Find Repository...")) {
|
||||
@members.map { case (owner, name) =>
|
||||
<li><a href="#" class="forked-owner" data-owner="@owner" data-name="@name">@gitbucket.core.helper.html.checkicon(owner == forkedRepository.owner) @owner/@name</a></li>
|
||||
@members.map { case (owner, name, defaultBranch) =>
|
||||
<li><a href="#" class="forked-owner" data-owner="@owner" data-name="@name" data-default-branch="@defaultBranch">@gitbucket.core.helper.html.checkicon(owner == forkedRepository.owner) @owner/@name</a></li>
|
||||
}
|
||||
}
|
||||
@gitbucket.core.helper.html.dropdown(forkedId, "compare", filter=("forked_branch", "Find Branch...")) {
|
||||
@@ -170,25 +170,46 @@
|
||||
}
|
||||
<script>
|
||||
$(function(){
|
||||
$('a.origin-owner, a.forked-owner, a.origin-branch, a.forked-branch').click(function(){
|
||||
var e = $(this);
|
||||
function updateSelector(e){
|
||||
e.parents('ul').find('i').attr('class', 'octicon');
|
||||
e.find('i').addClass('octicon-check');
|
||||
e.parents('div.btn-group').find('button span.strong').text(e.text());
|
||||
}
|
||||
|
||||
@if(members.isEmpty){
|
||||
location.href = '@helpers.url(repository)/compare/' +
|
||||
$.trim($('i.octicon-check').parents('a.origin-branch').data('branch')) + '...' +
|
||||
$.trim($('i.octicon-check').parents('a.forked-branch').data('branch'));
|
||||
} else {
|
||||
location.href = '@context.path/' +
|
||||
$.trim($('i.octicon-check').parents('a.forked-owner' ).data('owner')) + '/' +
|
||||
$.trim($('i.octicon-check').parents('a.forked-owner' ).data('name')) +'/compare/' +
|
||||
$.trim($('i.octicon-check').parents('a.origin-owner' ).data('owner')) + ':' +
|
||||
$.trim($('i.octicon-check').parents('a.origin-branch').data('branch')) + '...' +
|
||||
$.trim($('i.octicon-check').parents('a.forked-owner' ).data('owner')) + ':' +
|
||||
$.trim($('i.octicon-check').parents('a.forked-branch').data('branch'));
|
||||
}
|
||||
$('a.origin-owner').click(function(){
|
||||
updateSelector($(this));
|
||||
|
||||
location.href = '@context.path/' +
|
||||
$.trim($('i.octicon-check').parents('a.forked-owner' ).data('owner')) + '/' +
|
||||
$.trim($('i.octicon-check').parents('a.forked-owner' ).data('name')) +'/compare/' +
|
||||
$.trim($('i.octicon-check').parents('a.origin-owner' ).data('owner')) + ':' +
|
||||
$.trim($('i.octicon-check').parents('a.origin-owner' ).data('default-branch')) + '...' +
|
||||
$.trim($('i.octicon-check').parents('a.forked-owner' ).data('owner')) + ':' +
|
||||
$.trim($('i.octicon-check').parents('a.forked-branch').data('branch'));
|
||||
});
|
||||
|
||||
$('a.forked-owner').click(function(){
|
||||
updateSelector($(this));
|
||||
|
||||
location.href = '@context.path/' +
|
||||
$.trim($('i.octicon-check').parents('a.forked-owner' ).data('owner')) + '/' +
|
||||
$.trim($('i.octicon-check').parents('a.forked-owner' ).data('name')) +'/compare/' +
|
||||
$.trim($('i.octicon-check').parents('a.origin-owner' ).data('owner')) + ':' +
|
||||
$.trim($('i.octicon-check').parents('a.origin-branch').data('branch')) + '...' +
|
||||
$.trim($('i.octicon-check').parents('a.forked-owner' ).data('owner')) + ':' +
|
||||
$.trim($('i.octicon-check').parents('a.forked-owner' ).data('default-branch'));
|
||||
});
|
||||
|
||||
$('a.origin-branch, a.forked-branch').click(function(){
|
||||
updateSelector($(this));
|
||||
|
||||
location.href = '@context.path/' +
|
||||
$.trim($('i.octicon-check').parents('a.forked-owner' ).data('owner')) + '/' +
|
||||
$.trim($('i.octicon-check').parents('a.forked-owner' ).data('name')) +'/compare/' +
|
||||
$.trim($('i.octicon-check').parents('a.origin-owner' ).data('owner')) + ':' +
|
||||
$.trim($('i.octicon-check').parents('a.origin-branch').data('branch')) + '...' +
|
||||
$.trim($('i.octicon-check').parents('a.forked-owner' ).data('owner')) + ':' +
|
||||
$.trim($('i.octicon-check').parents('a.forked-branch').data('branch'));
|
||||
});
|
||||
|
||||
$('#show-form').click(function(){
|
||||
@@ -206,19 +227,12 @@ $(function(){
|
||||
function(data){ $('.check-conflict').html(data); });
|
||||
}
|
||||
|
||||
@if(members.isEmpty){
|
||||
checkConflict(
|
||||
$.trim($('i.octicon-check').parents('a.origin-branch').data('branch')),
|
||||
$.trim($('i.octicon-check').parents('a.forked-branch').data('branch'))
|
||||
);
|
||||
} else {
|
||||
checkConflict(
|
||||
$.trim($('i.octicon-check').parents('a.origin-owner' ).data('owner')) + ":" +
|
||||
$.trim($('i.octicon-check').parents('a.origin-branch').data('branch')),
|
||||
$.trim($('i.octicon-check').parents('a.forked-owner' ).data('owner')) + ":" +
|
||||
$.trim($('i.octicon-check').parents('a.forked-branch').data('branch'))
|
||||
);
|
||||
}
|
||||
checkConflict(
|
||||
$.trim($('i.octicon-check').parents('a.origin-owner' ).data('owner')) + ":" +
|
||||
$.trim($('i.octicon-check').parents('a.origin-branch').data('branch')),
|
||||
$.trim($('i.octicon-check').parents('a.forked-owner' ).data('owner')) + ":" +
|
||||
$.trim($('i.octicon-check').parents('a.forked-branch').data('branch'))
|
||||
);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<div class="box-content" style="line-height: 20pt; margin-bottom: 6px; padding: 10px 6px 10px 10px; background-color: #fff9ea">
|
||||
<strong><i class="menu-icon octicon octicon-git-branch"></i><span class="muted">@branch</span></strong>
|
||||
<a class="pull-right btn btn-success" style="position: relative; top: -4px;"
|
||||
href="@helpers.url(repository)/compare/@{parent.owner}:@{parent.repository.defaultBranch}...@{repository.owner}:@{branch}">Compare & pull request</a>
|
||||
href="@helpers.url(repository)/compare/@{parent.owner}:@{helpers.encodeRefName(parent.repository.defaultBranch)}...@{repository.owner}:@{helpers.encodeRefName(branch)}">Compare & pull request</a>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,24 +55,24 @@
|
||||
<span class="label label-info">LFS</span>
|
||||
}
|
||||
</div>
|
||||
<div class="box-header">
|
||||
@helpers.avatarLink(latestCommit, 28)
|
||||
<div class="box-header" style="line-height: 28px;">
|
||||
@helpers.avatarLink(latestCommit, 20)
|
||||
@helpers.user(latestCommit.authorName, latestCommit.authorEmailAddress, "username strong")
|
||||
<span class="muted">@gitbucket.core.helper.html.datetimeago(latestCommit.commitTime)</span>
|
||||
<span class="label label-default">@helpers.readableSize(content.size)</span>
|
||||
<a href="@helpers.url(repository)/commit/@latestCommit.id" class="commit-message">@helpers.link(latestCommit.summary, repository)</a>
|
||||
<div class="btn-group pull-right">
|
||||
@if(hasWritePermission && content.viewType == "text" && repository.branchList.contains(branch)){
|
||||
<a class="btn btn-sm btn-default" href="@helpers.url(repository)/edit/@helpers.encodeRefName((branch :: pathList).mkString("/"))">Edit</a>
|
||||
}
|
||||
<a class="btn btn-sm btn-default" href="@helpers.url(repository)/raw/@latestCommit.id/@helpers.encodeRefName(pathList.mkString("/"))">Raw</a>
|
||||
@if(content.viewType == "text"){
|
||||
<a class="btn btn-sm btn-default blame-action" href="@helpers.url(repository)/blame/@latestCommit.id/@helpers.encodeRefName(pathList.mkString("/"))"
|
||||
data-url="@helpers.url(repository)/get-blame/@helpers.encodeRefName((latestCommit.id :: pathList).mkString("/"))" data-repository="@helpers.url(repository)">Blame</a>
|
||||
}
|
||||
<a class="btn btn-sm btn-default" href="@helpers.url(repository)/commits/@helpers.encodeRefName((branch :: pathList).mkString("/"))">History</a>
|
||||
@if(hasWritePermission && content.viewType == "text" && repository.branchList.contains(branch)){
|
||||
<a class="btn btn-sm" style="padding-right: 4px;" href="@helpers.url(repository)/edit/@helpers.encodeRefName((branch :: pathList).mkString("/"))"><i class="octicon octicon-pencil"></i></a>
|
||||
}
|
||||
@if(hasWritePermission && repository.branchList.contains(branch)){
|
||||
<a class="btn btn-sm btn-danger" href="@helpers.url(repository)/remove/@helpers.encodeRefName((branch :: pathList).mkString("/"))">Delete</a>
|
||||
<a class="btn btn-sm" style="padding-right: 4px;" href="@helpers.url(repository)/remove/@helpers.encodeRefName((branch :: pathList).mkString("/"))"><i class="octicon octicon-trashcan"></i></a>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -196,11 +196,19 @@
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
@readme.map { case(filePath, content) =>
|
||||
<div id="readme" class="panel panel-default">
|
||||
<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>
|
||||
@readme.map { case (filePath, content) =>
|
||||
<div id="readme" class="box-header">
|
||||
<div class="strong" style="line-height: 28px;">
|
||||
<i class="octicon octicon-file"></i>
|
||||
@filePath.last
|
||||
@if(hasWritePermission){
|
||||
<div class="btn-group pull-right">
|
||||
<a class="btn btn-sm" style="padding-right: 4px;" href="@helpers.url(repository)/edit/@helpers.encodeRefName((branch :: filePath).mkString("/"))"><i class="octicon octicon-pencil"></i></a>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-content-bottom markdown-body" style="padding-left: 20px; padding-right: 20px;">@helpers.renderMarkup(filePath, content, branch, repository, false, false, true)</div>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,5 +50,15 @@ $(function(){
|
||||
$('#delete-form').submit(function(){
|
||||
return confirm('Once you delete a repository, there is no going back.\nAre you sure?');
|
||||
});
|
||||
$('#transfer-form').submit(function(){
|
||||
if($('#transfer-form').data('validated') === true){
|
||||
return confirm('Transfer to the repository owner you entered.\nAre you sure?');
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
$('#gc-form').submit(function(){
|
||||
return confirm('The garbage collection may take a long time.\nDo you want to execute it?');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -138,7 +138,8 @@ class AvatarImageProviderSpec extends FunSpec with MockitoSugar {
|
||||
oidc = None,
|
||||
skinName = "skin-blue",
|
||||
showMailAddress = false,
|
||||
pluginNetworkInstall = false
|
||||
pluginNetworkInstall = false,
|
||||
pluginProxy = None
|
||||
)
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user