diff options
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) |