(refs #179) Fetch from fork branch before merge

This commit is contained in:
Tomofumi Tanaka
2013-10-31 00:30:18 +09:00
parent af8a1234ed
commit 7d8300b3ce

View File

@@ -118,8 +118,14 @@ trait PullRequestsControllerBase extends ControllerBase {
// record activity // record activity
recordMergeActivity(owner, name, loginAccount.userName, issueId, form.message) recordMergeActivity(owner, name, loginAccount.userName, issueId, form.message)
// prepare merge branch // prepare head/merge branch
// TODO Dooes need update refs/pull/${issueId}/head branch before merge? val headName = s"refs/pull/${issueId}/head"
val headRef = new RefSpec(s"refs/heads/${pullreq.requestBranch}:${headName}").setForceUpdate(true)
git.fetch
.setRemote(getRepositoryDir(pullreq.requestUserName, pullreq.requestRepositoryName).toURI.toString)
.setRefSpecs(headRef)
.call
val updateMergeRef = git.getRepository.updateRef(s"refs/pull/${issueId}/merge") val updateMergeRef = git.getRepository.updateRef(s"refs/pull/${issueId}/merge")
updateMergeRef.setNewObjectId(git.getRepository.resolve(s"refs/heads/${pullreq.branch}")) updateMergeRef.setNewObjectId(git.getRepository.resolve(s"refs/heads/${pullreq.branch}"))
updateMergeRef.forceUpdate() updateMergeRef.forceUpdate()