@@ -41,22 +41,6 @@ func Update(ctx context.Context, pr *issues_model.PullRequest, doer *user_model.
4141 return fmt .Errorf ("HeadBranch of PR %d is up to date" , pr .Index )
4242 }
4343
44- if rebase {
45- defer func () {
46- go AddTestPullRequestTask (TestPullRequestOptions {
47- RepoID : pr .BaseRepo .ID ,
48- Doer : doer ,
49- Branch : pr .BaseBranch ,
50- IsSync : false ,
51- IsForcePush : false ,
52- OldCommitID : "" ,
53- NewCommitID : "" ,
54- })
55- }()
56-
57- return updateHeadByRebaseOnToBase (ctx , pr , doer )
58- }
59-
6044 if err := pr .LoadBaseRepo (ctx ); err != nil {
6145 log .Error ("unable to load BaseRepo for %-v during update-by-merge: %v" , pr , err )
6246 return fmt .Errorf ("unable to load BaseRepo for PR[%d] during update-by-merge: %w" , pr .ID , err )
@@ -74,6 +58,22 @@ func Update(ctx context.Context, pr *issues_model.PullRequest, doer *user_model.
7458 return fmt .Errorf ("unable to load HeadRepo for PR[%d] during update-by-merge: %w" , pr .ID , err )
7559 }
7660
61+ defer func () {
62+ go AddTestPullRequestTask (TestPullRequestOptions {
63+ RepoID : pr .BaseRepo .ID ,
64+ Doer : doer ,
65+ Branch : pr .BaseBranch ,
66+ IsSync : false ,
67+ IsForcePush : false ,
68+ OldCommitID : "" ,
69+ NewCommitID : "" ,
70+ })
71+ }()
72+
73+ if rebase {
74+ return updateHeadByRebaseOnToBase (ctx , pr , doer )
75+ }
76+
7777 // TODO: FakePR: it is somewhat hacky, but it is the only way to "merge" at the moment
7878 // ideally in the future the "merge" functions should be refactored to decouple from the PullRequest
7979 // now use a fake reverse PR to switch head&base repos/branches
@@ -90,19 +90,6 @@ func Update(ctx context.Context, pr *issues_model.PullRequest, doer *user_model.
9090 }
9191
9292 _ , err = doMergeAndPush (ctx , reversePR , doer , repo_model .MergeStyleMerge , "" , message , repository .PushTriggerPRUpdateWithBase )
93-
94- defer func () {
95- go AddTestPullRequestTask (TestPullRequestOptions {
96- RepoID : reversePR .HeadRepo .ID ,
97- Doer : doer ,
98- Branch : reversePR .HeadBranch ,
99- IsSync : false ,
100- IsForcePush : false ,
101- OldCommitID : "" ,
102- NewCommitID : "" ,
103- })
104- }()
105-
10693 return err
10794}
10895
0 commit comments