mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-05 04:56:02 +01:00
(refs #74)Small fix for test hook.
This commit is contained in:
@@ -133,20 +133,17 @@ trait RepositorySettingsControllerBase extends ControllerBase with FlashMapSuppo
|
||||
*/
|
||||
get("/:owner/:repository/settings/hooks/test")(ownerOnly { repository =>
|
||||
JGitUtil.withGit(getRepositoryDir(repository.owner, repository.name)){ git =>
|
||||
// TODO Retrieve only specified branch logs.
|
||||
val i = git.log.setMaxCount(3).call.iterator
|
||||
// TODO Don't use ListBuffer!!!!
|
||||
val list = new ListBuffer[CommitInfo]()
|
||||
while(i.hasNext){
|
||||
val commit = i.next
|
||||
list.append(new CommitInfo(commit))
|
||||
}
|
||||
import scala.collection.JavaConverters._
|
||||
val commits = git.log
|
||||
.add(git.getRepository.resolve(repository.repository.defaultBranch))
|
||||
.setMaxCount(3)
|
||||
.call.iterator.asScala.map(new CommitInfo(_))
|
||||
|
||||
val payload = WebHookPayload(
|
||||
git,
|
||||
"refs/heads/" + repository.repository.defaultBranch,
|
||||
repository,
|
||||
list.toList,
|
||||
commits.toList,
|
||||
getAccountByUserName(repository.owner).get)
|
||||
|
||||
callWebHook(repository.owner, repository.name, payload)
|
||||
|
||||
Reference in New Issue
Block a user