@@ -29,7 +29,7 @@ func checkPullRequestMergeableAndUpdateStatus(ctx context.Context, pr *issues_mo
2929// checkConflictsMergeTree uses git merge-tree to check for conflicts and if none are found checks if the patch is empty
3030// return true if there is conflicts otherwise return false
3131// pr.Status and pr.ConflictedFiles will be updated as necessary
32- func checkConflictsMergeTree (ctx context.Context , repoPath string , pr * issues_model.PullRequest , baseCommitID string ) (bool , error ) {
32+ func checkConflictsMergeTree (ctx context.Context , pr * issues_model.PullRequest , baseCommitID string ) (bool , error ) {
3333 treeHash , conflict , conflictFiles , err := gitrepo .MergeTree (ctx , pr .BaseRepo , pr .MergeBase , baseCommitID , pr .HeadCommitID )
3434 if err != nil {
3535 return false , fmt .Errorf ("MergeTree: %w" , err )
@@ -47,10 +47,7 @@ func checkConflictsMergeTree(ctx context.Context, repoPath string, pr *issues_mo
4747 // will return exit code 0 if there's no diff and exit code 1 if there's
4848 // a diff.
4949 isEmpty := true
50- if err = gitcmd .NewCommand ("diff-tree" , "--quiet" ).AddDynamicArguments (treeHash , pr .MergeBase ).
51- Run (ctx , & gitcmd.RunOpts {
52- Dir : repoPath ,
53- }); err != nil {
50+ if err = gitrepo .DiffTree (ctx , pr .BaseRepo , treeHash , pr .MergeBase ); err != nil {
5451 if ! gitcmd .IsErrorExitCode (err , 1 ) {
5552 return false , fmt .Errorf ("DiffTree: %w" , err )
5653 }
@@ -120,7 +117,7 @@ func checkPullRequestMergeableAndUpdateStatusMergeTree(ctx context.Context, pr *
120117 }
121118
122119 // 5. Check for conflicts
123- conflicted , err := checkConflictsMergeTree (ctx , pr . BaseRepo . RepoPath (), pr , baseCommitID )
120+ conflicted , err := checkConflictsMergeTree (ctx , pr , baseCommitID )
124121 if err != nil {
125122 log .Error ("checkConflictsMergeTree: %v" , err )
126123 pr .Status = issues_model .PullRequestStatusEmpty // if there is no merge base, then it's empty but we still need to allow the pull request created
0 commit comments