summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2019-12-27 21:15:04 +0000
committerGitHub <noreply@github.com>2019-12-27 21:15:04 +0000
commit4acca9d2e8618a5283495fcd3b313fd53c953f18 (patch)
tree3c0cfba28db36ae362e257b3fafe43773e9f30d2 /services
parentf2d03cda96eb5febbf9801f6b6cf5daa37220bc9 (diff)
downloadgitea-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 'services')
-rw-r--r--services/pull/pull.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/services/pull/pull.go b/services/pull/pull.go
index fb47df1c3a..6be9c2da17 100644
--- a/services/pull/pull.go
+++ b/services/pull/pull.go
@@ -242,10 +242,19 @@ func PushToBaseRepo(pr *models.PullRequest) (err error) {
_ = os.Remove(file)
+ if err = pr.LoadIssue(); err != nil {
+ return fmt.Errorf("unable to load issue %d for pr %d: %v", pr.IssueID, pr.ID, err)
+ }
+ if err = pr.Issue.LoadPoster(); err != nil {
+ return fmt.Errorf("unable to load poster %d for pr %d: %v", pr.Issue.PosterID, pr.ID, err)
+ }
+
if err = git.Push(headRepoPath, git.PushOptions{
Remote: tmpRemoteName,
Branch: fmt.Sprintf("%s:%s", pr.HeadBranch, headFile),
Force: true,
+ // Use InternalPushingEnvironment here because we know that pre-receive and post-receive do not run on a refs/pulls/...
+ Env: models.InternalPushingEnvironment(pr.Issue.Poster, pr.BaseRepo),
}); err != nil {
return fmt.Errorf("Push: %v", err)
}