summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorLars Lehtonen <lars.lehtonen@gmail.com>2020-07-06 05:07:07 -0700
committerGitHub <noreply@github.com>2020-07-06 13:07:07 +0100
commit56f222d44cd8d2787ad94105c5e219ebeeb10120 (patch)
tree5a9b8666bded7626019487f82589f54c597915fc /models
parentae2916c792888fd77572f4bfb37bc6793c9a80ef (diff)
downloadgitea-56f222d44cd8d2787ad94105c5e219ebeeb10120.tar.gz
gitea-56f222d44cd8d2787ad94105c5e219ebeeb10120.zip
models: break out of loops (#12159)
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'models')
-rw-r--r--models/repo_sign.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/models/repo_sign.go b/models/repo_sign.go
index c728a2911a..c9dd5ea4dc 100644
--- a/models/repo_sign.go
+++ b/models/repo_sign.go
@@ -103,12 +103,13 @@ func SignInitialCommit(repoPath string, u *User) (bool, string, error) {
return false, "", &ErrWontSign{noKey}
}
+Loop:
for _, rule := range rules {
switch rule {
case never:
return false, "", &ErrWontSign{never}
case always:
- break
+ break Loop
case pubkey:
keys, err := ListGPGKeys(u.ID, ListOptions{})
if err != nil {
@@ -138,12 +139,13 @@ func (repo *Repository) SignWikiCommit(u *User) (bool, string, error) {
return false, "", &ErrWontSign{noKey}
}
+Loop:
for _, rule := range rules {
switch rule {
case never:
return false, "", &ErrWontSign{never}
case always:
- break
+ break Loop
case pubkey:
keys, err := ListGPGKeys(u.ID, ListOptions{})
if err != nil {
@@ -190,12 +192,13 @@ func (repo *Repository) SignCRUDAction(u *User, tmpBasePath, parentCommit string
return false, "", &ErrWontSign{noKey}
}
+Loop:
for _, rule := range rules {
switch rule {
case never:
return false, "", &ErrWontSign{never}
case always:
- break
+ break Loop
case pubkey:
keys, err := ListGPGKeys(u.ID, ListOptions{})
if err != nil {