mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-06 05:25:50 +01:00
(refs #2)Implementing the comparing view.
This commit is contained in:
@@ -15,6 +15,7 @@ import org.eclipse.jgit.util.io.DisabledOutputStream
|
||||
import org.eclipse.jgit.errors.MissingObjectException
|
||||
import java.util.Date
|
||||
import org.eclipse.jgit.api.errors.NoHeadException
|
||||
import service.RepositoryService
|
||||
|
||||
/**
|
||||
* Provides complex JGit operations.
|
||||
@@ -419,7 +420,7 @@ object JGitUtil {
|
||||
case true if(logs.size < 2) => getCommitLog(i, logs :+ i.next)
|
||||
case _ => logs
|
||||
}
|
||||
|
||||
|
||||
val revWalk = new RevWalk(git.getRepository)
|
||||
revWalk.markStart(revWalk.parseCommit(git.getRepository.resolve(id)))
|
||||
|
||||
@@ -532,4 +533,14 @@ object JGitUtil {
|
||||
config.save
|
||||
}
|
||||
|
||||
def getDefaultBranch(git: Git, repository: RepositoryService.RepositoryInfo,
|
||||
revstr: String = ""): Option[(ObjectId, String)] = {
|
||||
Seq(
|
||||
if(revstr.isEmpty) repository.repository.defaultBranch else revstr,
|
||||
repository.branchList.head
|
||||
).map { rev =>
|
||||
(git.getRepository.resolve(rev), rev)
|
||||
}.find(_._1 != null)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user