(refs #74)Small fix for test hook.

This commit is contained in:
takezoe
2013-09-19 02:40:07 +09:00
parent 7e4c29f4cf
commit 73d9e69e43

View File

@@ -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)