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/repo.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/repo.go')
-rw-r--r-- | models/repo.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/models/repo.go b/models/repo.go index 53a9196aa7..0dbdcc11b5 100644 --- a/models/repo.go +++ b/models/repo.go @@ -1012,7 +1012,7 @@ func createDelegateHooks(repoPath string) (err error) { } // initRepoCommit temporarily changes with work directory. -func initRepoCommit(tmpPath string, u *User) (err error) { +func initRepoCommit(tmpPath string, repo *Repository, u *User) (err error) { commitTimeStr := time.Now().Format(time.RFC3339) sig := u.NewGitSig() @@ -1061,7 +1061,7 @@ func initRepoCommit(tmpPath string, u *User) (err error) { if stdout, err := git.NewCommand("push", "origin", "master"). SetDescription(fmt.Sprintf("initRepoCommit (git push): %s", tmpPath)). - RunInDir(tmpPath); err != nil { + RunInDirWithEnv(tmpPath, InternalPushingEnvironment(u, repo)); err != nil { log.Error("Failed to push back to master: Stdout: %s\nError: %v", stdout, err) return fmt.Errorf("git push: %v", err) } @@ -1219,7 +1219,7 @@ func initRepository(e Engine, repoPath string, u *User, repo *Repository, opts C } // Apply changes and commit. - if err = initRepoCommit(tmpDir, u); err != nil { + if err = initRepoCommit(tmpDir, repo, u); err != nil { return fmt.Errorf("initRepoCommit: %v", err) } } |