diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2022-04-01 10:55:30 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-01 10:55:30 +0800 |
commit | 124b072f0b69650baff086b9688d198f5a6761af (patch) | |
tree | fa18f7930053a8408e124875b5dec20e0309332b /services/repository/fork.go | |
parent | 3a73645502392110369b5d78fa2c9136e77e4aa2 (diff) | |
download | gitea-124b072f0b69650baff086b9688d198f5a6761af.tar.gz gitea-124b072f0b69650baff086b9688d198f5a6761af.zip |
Remove `git.Command.Run` and `git.Command.RunInDir*` (#19280)
Follows #19266, #8553, Close #18553, now there are only three `Run..(&RunOpts{})` functions.
* before: `stdout, err := RunInDir(path)`
* now: `stdout, _, err := RunStdString(&git.RunOpts{Dir:path})`
Diffstat (limited to 'services/repository/fork.go')
-rw-r--r-- | services/repository/fork.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/services/repository/fork.go b/services/repository/fork.go index 220fbeb992..a2ef75bbd0 100644 --- a/services/repository/fork.go +++ b/services/repository/fork.go @@ -111,7 +111,7 @@ func ForkRepository(ctx context.Context, doer, owner *user_model.User, opts Fork if stdout, _, err := git.NewCommand(txCtx, "clone", "--bare", oldRepoPath, repoPath). SetDescription(fmt.Sprintf("ForkRepository(git clone): %s to %s", opts.BaseRepo.FullName(), repo.FullName())). - RunWithContextBytes(&git.RunContext{Timeout: 10 * time.Minute}); err != nil { + RunStdBytes(&git.RunOpts{Timeout: 10 * time.Minute}); err != nil { log.Error("Fork Repository (git clone) Failed for %v (from %v):\nStdout: %s\nError: %v", repo, opts.BaseRepo, stdout, err) return fmt.Errorf("git clone: %v", err) } @@ -120,9 +120,9 @@ func ForkRepository(ctx context.Context, doer, owner *user_model.User, opts Fork return fmt.Errorf("checkDaemonExportOK: %v", err) } - if stdout, err := git.NewCommand(txCtx, "update-server-info"). + if stdout, _, err := git.NewCommand(txCtx, "update-server-info"). SetDescription(fmt.Sprintf("ForkRepository(git update-server-info): %s", repo.FullName())). - RunInDir(repoPath); err != nil { + RunStdString(&git.RunOpts{Dir: repoPath}); err != nil { log.Error("Fork Repository (git update-server-info) failed for %v:\nStdout: %s\nError: %v", repo, stdout, err) return fmt.Errorf("git update-server-info: %v", err) } |