Skip to content

Commit 3d0222c

Browse files
committed
allow empty pull request
1 parent 2f74aec commit 3d0222c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

services/pull/conflicts.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ func checkPullRequestMergeableAndUpdateStatusMergeTree(ctx context.Context, pr *
109109
pr.MergeBase, err = gitrepo.MergeBase(ctx, pr.BaseRepo, baseCommitID, pr.HeadCommitID)
110110
if err != nil {
111111
log.Error("GetMergeBase: %v and can't find commit ID for base: %v", err, baseCommitID)
112-
// FIXME: is this the right thing to do?
113-
pr.MergeBase = baseCommitID
112+
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
113+
return nil
114114
}
115115

116116
// 4. if base == head, then it's an ancestor
@@ -122,7 +122,8 @@ func checkPullRequestMergeableAndUpdateStatusMergeTree(ctx context.Context, pr *
122122
// 5. Check for conflicts
123123
conflicted, err := checkConflictsMergeTree(ctx, pr.BaseRepo.RepoPath(), pr, baseCommitID)
124124
if err != nil {
125-
return fmt.Errorf("checkConflictsMergeTree: %w", err)
125+
log.Error("checkConflictsMergeTree: %v", err)
126+
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
126127
}
127128
if conflicted || pr.Status == issues_model.PullRequestStatusEmpty {
128129
return nil

0 commit comments

Comments
 (0)