@@ -15,9 +15,9 @@ import (
15
15
"strings"
16
16
"time"
17
17
18
- "code.gitea.io/gitea/models"
19
18
"code.gitea.io/gitea/modules/git"
20
19
"code.gitea.io/gitea/modules/private"
20
+ repo_module "code.gitea.io/gitea/modules/repository"
21
21
"code.gitea.io/gitea/modules/setting"
22
22
"code.gitea.io/gitea/modules/util"
23
23
@@ -162,7 +162,7 @@ func (n *nilWriter) WriteString(s string) (int, error) {
162
162
}
163
163
164
164
func runHookPreReceive (c * cli.Context ) error {
165
- if os .Getenv (models .EnvIsInternal ) == "true" {
165
+ if isInternal , _ := strconv . ParseBool ( os .Getenv (repo_module .EnvIsInternal )); isInternal {
166
166
return nil
167
167
}
168
168
ctx , cancel := installSignals ()
@@ -180,12 +180,12 @@ Gitea or set your environment appropriately.`, "")
180
180
}
181
181
182
182
// the environment is set by serv command
183
- isWiki := os .Getenv (models .EnvRepoIsWiki ) == "true"
184
- username := os .Getenv (models .EnvRepoUsername )
185
- reponame := os .Getenv (models .EnvRepoName )
186
- userID , _ := strconv .ParseInt (os .Getenv (models .EnvPusherID ), 10 , 64 )
187
- prID , _ := strconv .ParseInt (os .Getenv (models .EnvPRID ), 10 , 64 )
188
- deployKeyID , _ := strconv .ParseInt (os .Getenv (models .EnvDeployKeyID ), 10 , 64 )
183
+ isWiki , _ := strconv . ParseBool ( os .Getenv (repo_module .EnvRepoIsWiki ))
184
+ username := os .Getenv (repo_module .EnvRepoUsername )
185
+ reponame := os .Getenv (repo_module .EnvRepoName )
186
+ userID , _ := strconv .ParseInt (os .Getenv (repo_module .EnvPusherID ), 10 , 64 )
187
+ prID , _ := strconv .ParseInt (os .Getenv (repo_module .EnvPRID ), 10 , 64 )
188
+ deployKeyID , _ := strconv .ParseInt (os .Getenv (repo_module .EnvDeployKeyID ), 10 , 64 )
189
189
190
190
hookOptions := private.HookOptions {
191
191
UserID : userID ,
@@ -314,7 +314,7 @@ func runHookPostReceive(c *cli.Context) error {
314
314
}
315
315
316
316
// Now if we're an internal don't do anything else
317
- if os .Getenv (models .EnvIsInternal ) == "true" {
317
+ if isInternal , _ := strconv . ParseBool ( os .Getenv (repo_module .EnvIsInternal )); isInternal {
318
318
return nil
319
319
}
320
320
@@ -343,11 +343,11 @@ Gitea or set your environment appropriately.`, "")
343
343
}
344
344
345
345
// the environment is set by serv command
346
- repoUser := os .Getenv (models .EnvRepoUsername )
347
- isWiki := os .Getenv (models .EnvRepoIsWiki ) == "true"
348
- repoName := os .Getenv (models .EnvRepoName )
349
- pusherID , _ := strconv .ParseInt (os .Getenv (models .EnvPusherID ), 10 , 64 )
350
- pusherName := os .Getenv (models .EnvPusherName )
346
+ repoUser := os .Getenv (repo_module .EnvRepoUsername )
347
+ isWiki , _ := strconv . ParseBool ( os .Getenv (repo_module .EnvRepoIsWiki ))
348
+ repoName := os .Getenv (repo_module .EnvRepoName )
349
+ pusherID , _ := strconv .ParseInt (os .Getenv (repo_module .EnvPusherID ), 10 , 64 )
350
+ pusherName := os .Getenv (repo_module .EnvPusherName )
351
351
352
352
hookOptions := private.HookOptions {
353
353
UserName : pusherName ,
@@ -503,10 +503,10 @@ Gitea or set your environment appropriately.`, "")
503
503
}
504
504
505
505
reader := bufio .NewReader (os .Stdin )
506
- repoUser := os .Getenv (models .EnvRepoUsername )
507
- repoName := os .Getenv (models .EnvRepoName )
508
- pusherID , _ := strconv .ParseInt (os .Getenv (models .EnvPusherID ), 10 , 64 )
509
- pusherName := os .Getenv (models .EnvPusherName )
506
+ repoUser := os .Getenv (repo_module .EnvRepoUsername )
507
+ repoName := os .Getenv (repo_module .EnvRepoName )
508
+ pusherID , _ := strconv .ParseInt (os .Getenv (repo_module .EnvPusherID ), 10 , 64 )
509
+ pusherName := os .Getenv (repo_module .EnvPusherName )
510
510
511
511
// 1. Version and features negotiation.
512
512
// S: PKT-LINE(version=1\0push-options atomic...) / PKT-LINE(version=1\n)
0 commit comments