mirror of
https://github.com/go-gitea/gitea.git
synced 2024-05-11 05:55:29 +00:00
Delete old git.NewCommand() and use it as git.NewCommandContext() (#18552)
This commit is contained in:
@ -92,7 +92,7 @@ func getMergeCommit(ctx context.Context, pr *models.PullRequest) (*git.Commit, e
|
||||
headFile := pr.GetGitRefName()
|
||||
|
||||
// Check if a pull request is merged into BaseBranch
|
||||
_, err = git.NewCommandContext(ctx, "merge-base", "--is-ancestor", headFile, pr.BaseBranch).
|
||||
_, err = git.NewCommand(ctx, "merge-base", "--is-ancestor", headFile, pr.BaseBranch).
|
||||
RunInDirWithEnv(pr.BaseRepo.RepoPath(), []string{"GIT_INDEX_FILE=" + indexTmpPath, "GIT_DIR=" + pr.BaseRepo.RepoPath()})
|
||||
if err != nil {
|
||||
// Errors are signaled by a non-zero status that is not 1
|
||||
@ -113,7 +113,7 @@ func getMergeCommit(ctx context.Context, pr *models.PullRequest) (*git.Commit, e
|
||||
cmd := commitID[:40] + ".." + pr.BaseBranch
|
||||
|
||||
// Get the commit from BaseBranch where the pull request got merged
|
||||
mergeCommit, err := git.NewCommandContext(ctx, "rev-list", "--ancestry-path", "--merges", "--reverse", cmd).
|
||||
mergeCommit, err := git.NewCommand(ctx, "rev-list", "--ancestry-path", "--merges", "--reverse", cmd).
|
||||
RunInDirWithEnv("", []string{"GIT_INDEX_FILE=" + indexTmpPath, "GIT_DIR=" + pr.BaseRepo.RepoPath()})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("git rev-list --ancestry-path --merges --reverse: %v", err)
|
||||
|
Reference in New Issue
Block a user