mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-09 06:55:54 +01:00
Refuse deletion of the default branch
This commit is contained in:
@@ -51,7 +51,11 @@ object ProtectedBranchService {
|
|||||||
(implicit session: Session): Option[String] = {
|
(implicit session: Session): Option[String] = {
|
||||||
val branch = command.getRefName.stripPrefix("refs/heads/")
|
val branch = command.getRefName.stripPrefix("refs/heads/")
|
||||||
if(branch != command.getRefName){
|
if(branch != command.getRefName){
|
||||||
|
if(command.getType == ReceiveCommand.Type.DELETE && branch == "test1"){ // TODO check default branch
|
||||||
|
Some(s"refusing to delete the branch: ${command.getRefName}.")
|
||||||
|
} else {
|
||||||
getProtectedBranchInfo(owner, repository, branch).getStopReason(receivePack.isAllowNonFastForwards, command, pusher)
|
getProtectedBranchInfo(owner, repository, branch).getStopReason(receivePack.isAllowNonFastForwards, command, pusher)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user