diff options
author | zeripath <art27@cantab.net> | 2019-12-27 21:15:04 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-27 21:15:04 +0000 |
commit | 4acca9d2e8618a5283495fcd3b313fd53c953f18 (patch) | |
tree | 3c0cfba28db36ae362e257b3fafe43773e9f30d2 /models/helper_environment.go | |
parent | f2d03cda96eb5febbf9801f6b6cf5daa37220bc9 (diff) | |
download | gitea-4acca9d2e8618a5283495fcd3b313fd53c953f18.tar.gz gitea-4acca9d2e8618a5283495fcd3b313fd53c953f18.zip |
Properly enforce gitea environment for pushes (#9501)
#8982 attempted to enforce the gitea environment for pushes - unfortunately it tested the settings before they were actually read in - and therefore does not do that!
Diffstat (limited to 'models/helper_environment.go')
-rw-r--r-- | models/helper_environment.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/models/helper_environment.go b/models/helper_environment.go index 2095205db3..35af17adb1 100644 --- a/models/helper_environment.go +++ b/models/helper_environment.go @@ -10,6 +10,16 @@ import ( "strings" ) +// InternalPushingEnvironment returns an os environment to switch off hooks on push +// It is recommended to avoid using this unless you are pushing within a transaction +// or if you absolutely are sure that post-receive and pre-receive will do nothing +// We provide the full pushing-environment for other hook providers +func InternalPushingEnvironment(doer *User, repo *Repository) []string { + return append(PushingEnvironment(doer, repo), + EnvIsInternal+"=true", + ) +} + // PushingEnvironment returns an os environment to allow hooks to work on push func PushingEnvironment(doer *User, repo *Repository) []string { return FullPushingEnvironment(doer, doer, repo, repo.Name, 0) |