summaryrefslogtreecommitdiffstats
path: root/models/repo_generate.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2019-11-30 08:40:22 -0600
committerLauris BH <lauris@nix.lv>2019-11-30 16:40:22 +0200
commit60c5339042a605076482320313e8f9498dd72af9 (patch)
treebef1e4a0fb9565140fbf142f13d3b7e5f334031d /models/repo_generate.go
parent8f8c250ddbe8dfe785340cb45cbae71c4833acf3 (diff)
downloadgitea-60c5339042a605076482320313e8f9498dd72af9.tar.gz
gitea-60c5339042a605076482320313e8f9498dd72af9.zip
Graceful: Cancel Process on monitor pages & HammerTime (#9213)
* Graceful: Create callbacks to with contexts * Graceful: Say when Gitea is completely finished * Graceful: Git and Process within HammerTime Force all git commands to terminate at HammerTime Force all process commands to terminate at HammerTime Move almost all git processes to run as git Commands * Graceful: Always Hammer after Shutdown * ProcessManager: Add cancel functionality * Fix tests * Make sure that process.Manager.Kill() cancels * Make threadsafe access to Processes and remove own unused Kill * Remove cmd from the process manager as it is no longer used * the default context is the correct context * get rid of double till
Diffstat (limited to 'models/repo_generate.go')
-rw-r--r--models/repo_generate.go14
1 files changed, 5 insertions, 9 deletions
diff --git a/models/repo_generate.go b/models/repo_generate.go
index 56a3940ac1..6dd8540d9e 100644
--- a/models/repo_generate.go
+++ b/models/repo_generate.go
@@ -16,7 +16,6 @@ import (
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
- "code.gitea.io/gitea/modules/process"
"code.gitea.io/gitea/modules/util"
"github.com/gobwas/glob"
@@ -168,14 +167,11 @@ func generateRepoCommit(e Engine, repo, templateRepo, generateRepo *Repository,
}
repoPath := repo.repoPath(e)
- _, stderr, err := process.GetManager().ExecDirEnv(
- -1, tmpDir,
- fmt.Sprintf("generateRepoCommit(git remote add): %s", repoPath),
- env,
- git.GitExecutable, "remote", "add", "origin", repoPath,
- )
- if err != nil {
- return fmt.Errorf("git remote add: %v - %s", err, stderr)
+ if stdout, err := git.NewCommand("remote", "add", "origin", repoPath).
+ SetDescription(fmt.Sprintf("generateRepoCommit (git remote add): %s to %s", templateRepoPath, tmpDir)).
+ RunInDirWithEnv(tmpDir, env); err != nil {
+ log.Error("Unable to add %v as remote origin to temporary repo to %s: stdout %s\nError: %v", repo, tmpDir, stdout, err)
+ return fmt.Errorf("git remote add: %v", err)
}
return initRepoCommit(tmpDir, repo.Owner)