Skip to content

Commit

Permalink
Fix panic on push at #7611 (#7615) (#7618)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
zeripath committed Jul 25, 2019
1 parent 5a3d986 commit b7e41f7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion models/branches.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (protectBranch *ProtectedBranch) HasEnoughApprovals(pr *PullRequest) bool {

// GetGrantedApprovalsCount returns the number of granted approvals for pr. A granted approval must be authored by a user in an approval whitelist.
func (protectBranch *ProtectedBranch) GetGrantedApprovalsCount(pr *PullRequest) int64 {
reviews, err := GetReviewersByPullID(pr.Issue.ID)
reviews, err := GetReviewersByPullID(pr.IssueID)
if err != nil {
log.Error("GetReviewersByPullID: %v", err)
return 0
Expand Down
2 changes: 1 addition & 1 deletion modules/pull/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func Merge(pr *models.PullRequest, doer *models.User, baseGitRepo *git.Repositor
}

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

Expand Down

0 comments on commit b7e41f7

Please sign in to comment.