diff options
author | zeripath <art27@cantab.net> | 2020-08-30 08:24:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-30 08:24:39 +0100 |
commit | d257485bc0026c9717fe7bf4c9953ad1b7a1a9ae (patch) | |
tree | 701493ea83b4f416c5e7ea6ffd5a9dd291d44d03 /models | |
parent | 17fbbe97d7b4fca45d112f924191600eff52957b (diff) | |
download | gitea-d257485bc0026c9717fe7bf4c9953ad1b7a1a9ae.tar.gz gitea-d257485bc0026c9717fe7bf4c9953ad1b7a1a9ae.zip |
Rename models.ProtectedBranchRepoID to models.EnvRepoID and ensure EnvPusherEmail is set (#12646)
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'models')
-rw-r--r-- | models/branches.go | 7 | ||||
-rw-r--r-- | models/helper_environment.go | 16 |
2 files changed, 11 insertions, 12 deletions
diff --git a/models/branches.go b/models/branches.go index 38aa79d2dc..20988deed7 100644 --- a/models/branches.go +++ b/models/branches.go @@ -19,13 +19,6 @@ import ( "github.com/unknwon/com" ) -const ( - // ProtectedBranchRepoID protected Repo ID - ProtectedBranchRepoID = "GITEA_REPO_ID" - // ProtectedBranchPRID protected Repo PR ID - ProtectedBranchPRID = "GITEA_PR_ID" -) - // ProtectedBranch struct type ProtectedBranch struct { ID int64 `xorm:"pk autoincr"` diff --git a/models/helper_environment.go b/models/helper_environment.go index bc9d4c8fce..f1c758d65d 100644 --- a/models/helper_environment.go +++ b/models/helper_environment.go @@ -14,12 +14,14 @@ import ( const ( EnvRepoName = "GITEA_REPO_NAME" EnvRepoUsername = "GITEA_REPO_USER_NAME" + EnvRepoID = "GITEA_REPO_ID" EnvRepoIsWiki = "GITEA_REPO_IS_WIKI" EnvPusherName = "GITEA_PUSHER_NAME" EnvPusherEmail = "GITEA_PUSHER_EMAIL" EnvPusherID = "GITEA_PUSHER_ID" EnvKeyID = "GITEA_KEY_ID" EnvIsDeployKey = "GITEA_IS_DEPLOY_KEY" + EnvPRID = "GITEA_PR_ID" EnvIsInternal = "GITEA_INTERNAL_PUSH" ) @@ -48,9 +50,7 @@ func FullPushingEnvironment(author, committer *User, repo *Repository, repoName authorSig := author.NewGitSig() committerSig := committer.NewGitSig() - // We should add "SSH_ORIGINAL_COMMAND=gitea-internal", - // once we have hook and pushing infrastructure working correctly - return append(os.Environ(), + environ := append(os.Environ(), "GIT_AUTHOR_NAME="+authorSig.Name, "GIT_AUTHOR_EMAIL="+authorSig.Email, "GIT_COMMITTER_NAME="+committerSig.Name, @@ -60,9 +60,15 @@ func FullPushingEnvironment(author, committer *User, repo *Repository, repoName EnvRepoIsWiki+"="+isWiki, EnvPusherName+"="+committer.Name, EnvPusherID+"="+fmt.Sprintf("%d", committer.ID), - ProtectedBranchRepoID+"="+fmt.Sprintf("%d", repo.ID), - ProtectedBranchPRID+"="+fmt.Sprintf("%d", prID), + EnvRepoID+"="+fmt.Sprintf("%d", repo.ID), + EnvPRID+"="+fmt.Sprintf("%d", prID), "SSH_ORIGINAL_COMMAND=gitea-internal", ) + if !committer.KeepEmailPrivate { + environ = append(environ, EnvPusherEmail+"="+committer.Email) + } + + return environ + } |