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 =>
|
get("/:owner/:repository/settings/hooks/test")(ownerOnly { repository =>
|
||||||
JGitUtil.withGit(getRepositoryDir(repository.owner, repository.name)){ git =>
|
JGitUtil.withGit(getRepositoryDir(repository.owner, repository.name)){ git =>
|
||||||
// TODO Retrieve only specified branch logs.
|
import scala.collection.JavaConverters._
|
||||||
val i = git.log.setMaxCount(3).call.iterator
|
val commits = git.log
|
||||||
// TODO Don't use ListBuffer!!!!
|
.add(git.getRepository.resolve(repository.repository.defaultBranch))
|
||||||
val list = new ListBuffer[CommitInfo]()
|
.setMaxCount(3)
|
||||||
while(i.hasNext){
|
.call.iterator.asScala.map(new CommitInfo(_))
|
||||||
val commit = i.next
|
|
||||||
list.append(new CommitInfo(commit))
|
|
||||||
}
|
|
||||||
|
|
||||||
val payload = WebHookPayload(
|
val payload = WebHookPayload(
|
||||||
git,
|
git,
|
||||||
"refs/heads/" + repository.repository.defaultBranch,
|
"refs/heads/" + repository.repository.defaultBranch,
|
||||||
repository,
|
repository,
|
||||||
list.toList,
|
commits.toList,
|
||||||
getAccountByUserName(repository.owner).get)
|
getAccountByUserName(repository.owner).get)
|
||||||
|
|
||||||
callWebHook(repository.owner, repository.name, payload)
|
callWebHook(repository.owner, repository.name, payload)
|
||||||
|
|||||||
Reference in New Issue
Block a user