Skip to content

Commit a66e32d

Browse files
committed
Fix bug
1 parent b26ecc2 commit a66e32d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

services/pull/update.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,13 @@ func Update(ctx context.Context, pr *issues_model.PullRequest, doer *user_model.
3939
return fmt.Errorf("unable to load BaseRepo for PR[%d] during update-by-merge: %w", pr.ID, err)
4040
}
4141

42-
diffCount, err := GetDiverging(ctx, pr)
43-
if err != nil {
44-
return err
45-
} else if diffCount.Behind == 0 {
46-
return fmt.Errorf("HeadBranch of PR %d is up to date", pr.Index)
42+
if pr.ID > 0 { // only a real PR needs to check this
43+
diffCount, err := GetDiverging(ctx, pr)
44+
if err != nil {
45+
return err
46+
} else if diffCount.Behind == 0 {
47+
return fmt.Errorf("HeadBranch of PR %d is up to date", pr.Index)
48+
}
4749
}
4850

4951
if err := pr.LoadHeadRepo(ctx); err != nil {

0 commit comments

Comments
 (0)