mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-14 09:25:49 +01:00
(refs #1367)Allow fast-forward push even if branch is protected
This commit is contained in:
@@ -86,7 +86,7 @@ object ProtectedBranchService {
|
|||||||
def getStopReason(isAllowNonFastForwards: Boolean, command: ReceiveCommand, pusher: String)(implicit session: Session): Option[String] = {
|
def getStopReason(isAllowNonFastForwards: Boolean, command: ReceiveCommand, pusher: String)(implicit session: Session): Option[String] = {
|
||||||
if(enabled){
|
if(enabled){
|
||||||
command.getType() match {
|
command.getType() match {
|
||||||
case ReceiveCommand.Type.UPDATE|ReceiveCommand.Type.UPDATE_NONFASTFORWARD if isAllowNonFastForwards =>
|
case ReceiveCommand.Type.UPDATE_NONFASTFORWARD if isAllowNonFastForwards =>
|
||||||
Some("Cannot force-push to a protected branch")
|
Some("Cannot force-push to a protected branch")
|
||||||
case ReceiveCommand.Type.UPDATE|ReceiveCommand.Type.UPDATE_NONFASTFORWARD if needStatusCheck(pusher) =>
|
case ReceiveCommand.Type.UPDATE|ReceiveCommand.Type.UPDATE_NONFASTFORWARD if needStatusCheck(pusher) =>
|
||||||
unSuccessedContexts(command.getNewId.name) match {
|
unSuccessedContexts(command.getNewId.name) match {
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ import scala.collection.JavaConverters._
|
|||||||
class CommitLogHook(owner: String, repository: String, pusher: String, baseUrl: String)(implicit session: Session)
|
class CommitLogHook(owner: String, repository: String, pusher: String, baseUrl: String)(implicit session: Session)
|
||||||
extends PostReceiveHook with PreReceiveHook
|
extends PostReceiveHook with PreReceiveHook
|
||||||
with RepositoryService with AccountService with IssuesService with ActivityService with PullRequestService with WebHookService
|
with RepositoryService with AccountService with IssuesService with ActivityService with PullRequestService with WebHookService
|
||||||
with WebHookPullRequestService with ProtectedBranchService {
|
with WebHookPullRequestService {
|
||||||
|
|
||||||
private val logger = LoggerFactory.getLogger(classOf[CommitLogHook])
|
private val logger = LoggerFactory.getLogger(classOf[CommitLogHook])
|
||||||
private var existIds: Seq[String] = Nil
|
private var existIds: Seq[String] = Nil
|
||||||
|
|||||||
Reference in New Issue
Block a user