mirror of
https://github.com/gitbucket/gitbucket.git
synced 2026-05-07 11:16:18 +02:00
Merge pull request #2147 from uli-heller/jgit-5.1.1
Jgit 5.1.1 - updated to the recent version of jgit and fixed deprecation warnings
This commit is contained in:
@@ -6,7 +6,7 @@ val Name = "gitbucket"
|
||||
val GitBucketVersion = "4.28.0"
|
||||
val ScalatraVersion = "2.6.3"
|
||||
val JettyVersion = "9.4.11.v20180605"
|
||||
val JgitVersion = "5.0.1.201806211838-r"
|
||||
val JgitVersion = "5.1.1.201809181055-r"
|
||||
|
||||
lazy val root = (project in file("."))
|
||||
.enablePlugins(SbtTwirl, ScalatraPlugin)
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -740,15 +740,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 +783,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
|
||||
|
||||
Reference in New Issue
Block a user