mirror of
https://github.com/go-gitea/gitea
synced 2025-08-12 12:38:20 +00:00
Fix deletion of unprotected branches (#2630)
* fix deletion of unprotected branches * fmt fix * changed internal protected branch api * fix lint error Signed-off-by: David Schneiderbauer <dschneiderbauer@gmail.com>
This commit is contained in:
committed by
Lauris BH
parent
3cc5b11b0d
commit
e38e502e20
@@ -126,7 +126,7 @@ func runHookPreReceive(c *cli.Context) error {
|
||||
log.GitLogger.Fatal(2, "retrieve protected branches information failed")
|
||||
}
|
||||
|
||||
if protectBranch != nil {
|
||||
if protectBranch != nil && protectBranch.IsProtected() {
|
||||
// check and deletion
|
||||
if newCommitID == git.EmptySHA {
|
||||
fail(fmt.Sprintf("branch %s is protected from deletion", branchName), "")
|
||||
|
Reference in New Issue
Block a user