Skip to content

Commit 6485962

Browse files
authored
Fix panic on push at #7611 (#7615)
* Fix panic in #7611 Use pr.IssueID instead of pr.Issue.ID as Issue may not be loaded and is unnecessary * Only fetch the head branch from the remote
1 parent 734aa96 commit 6485962

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

models/branches.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func (protectBranch *ProtectedBranch) HasEnoughApprovals(pr *PullRequest) bool {
101101

102102
// GetGrantedApprovalsCount returns the number of granted approvals for pr. A granted approval must be authored by a user in an approval whitelist.
103103
func (protectBranch *ProtectedBranch) GetGrantedApprovalsCount(pr *PullRequest) int64 {
104-
reviews, err := GetReviewersByPullID(pr.Issue.ID)
104+
reviews, err := GetReviewersByPullID(pr.IssueID)
105105
if err != nil {
106106
log.Error("GetReviewersByPullID: %v", err)
107107
return 0

modules/pull/merge.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func Merge(pr *models.PullRequest, doer *models.User, baseGitRepo *git.Repositor
101101
}
102102

103103
// Fetch head branch
104-
if err := git.NewCommand("fetch", remoteRepoName).RunInDirPipeline(tmpBasePath, nil, &errbuf); err != nil {
104+
if err := git.NewCommand("fetch", remoteRepoName, pr.HeadBranch).RunInDirPipeline(tmpBasePath, nil, &errbuf); err != nil {
105105
return fmt.Errorf("git fetch [%s -> %s]: %s", headRepoPath, tmpBasePath, errbuf.String())
106106
}
107107

0 commit comments

Comments
 (0)