Delete old git.NewCommand() and use it as git.NewCommandContext() (#18552)

This commit is contained in:
6543 2022-02-06 20:01:47 +01:00 committed by GitHub
parent 8ae5e6d7fd
commit 3043eb36bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
74 changed files with 258 additions and 263 deletions

View file

@ -108,7 +108,7 @@ func ForkRepository(doer, owner *user_model.User, opts ForkRepoOptions) (_ *repo
needsRollback = true
repoPath := repo_model.RepoPath(owner.Name, repo.Name)
if stdout, err := git.NewCommandContext(ctx,
if stdout, err := git.NewCommand(ctx,
"clone", "--bare", oldRepoPath, repoPath).
SetDescription(fmt.Sprintf("ForkRepository(git clone): %s to %s", opts.BaseRepo.FullName(), repo.FullName())).
RunInDirTimeout(10*time.Minute, ""); err != nil {
@ -120,7 +120,7 @@ func ForkRepository(doer, owner *user_model.User, opts ForkRepoOptions) (_ *repo
return fmt.Errorf("checkDaemonExportOK: %v", err)
}
if stdout, err := git.NewCommandContext(ctx, "update-server-info").
if stdout, err := git.NewCommand(ctx, "update-server-info").
SetDescription(fmt.Sprintf("ForkRepository(git update-server-info): %s", repo.FullName())).
RunInDir(repoPath); err != nil {
log.Error("Fork Repository (git update-server-info) failed for %v:\nStdout: %s\nError: %v", repo, stdout, err)