Disable the post commit hook for Wiki repository.

This commit is contained in:
takezoe
2014-02-01 07:06:17 +09:00
parent 738b0cfe9a
commit 1c529eea3d

View File

@@ -69,7 +69,9 @@ class GitBucketReceivePackFactory extends ReceivePackFactory[HttpServletRequest]
logger.debug("repository:" + owner + "/" + repository)
logger.debug("baseURL:" + baseURL)
if(!repository.endsWith(".wiki")){
receivePack.setPostReceiveHook(new CommitLogHook(owner, repository, pusher, baseURL))
}
receivePack
}
}
@@ -83,6 +85,7 @@ class CommitLogHook(owner: String, repository: String, pusher: String, baseURL:
private val logger = LoggerFactory.getLogger(classOf[CommitLogHook])
def onPostReceive(receivePack: ReceivePack, commands: java.util.Collection[ReceiveCommand]): Unit = {
try {
using(Git.open(Directory.getRepositoryDir(owner, repository))) { git =>
commands.asScala.foreach { command =>
logger.debug(s"commandType: ${command.getType}, refName: ${command.getRefName}")
@@ -155,6 +158,12 @@ class CommitLogHook(owner: String, repository: String, pusher: String, baseURL:
}
// update repository last modified time.
updateLastActivityDate(owner, repository)
} catch {
case ex: Exception => {
logger.error(ex.toString, ex)
throw ex
}
}
}
private def createIssueComment(commit: CommitInfo) = {