mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-07 22:15:51 +01:00
Merge branch 'pullreq-update-in-push' of https://github.com/odz/gitbucket into odz-pullreq-update-in-push
Conflicts: src/main/scala/app/PullRequestsController.scala
This commit is contained in:
@@ -70,11 +70,8 @@ trait PullRequestsControllerBase extends ControllerBase {
|
||||
val name = repository.name
|
||||
getPullRequest(owner, name, issueId) map { case(issue, pullreq) =>
|
||||
using(Git.open(getRepositoryDir(owner, name))){ git =>
|
||||
// prepare head branch
|
||||
val commitIdTo = fetchPullRequest(git, issueId, pullreq.requestUserName, pullreq.requestRepositoryName, pullreq.requestBranch)
|
||||
updateCommitIdTo(owner, name, issueId, commitIdTo)
|
||||
|
||||
val (commits, diffs) = getRequestCompareInfo(owner, name, pullreq.commitIdFrom, owner, name, commitIdTo)
|
||||
val (commits, diffs) =
|
||||
getRequestCompareInfo(owner, name, pullreq.commitIdFrom, owner, name, pullreq.commitIdTo)
|
||||
|
||||
pulls.html.pullreq(
|
||||
issue, pullreq,
|
||||
@@ -446,20 +443,4 @@ trait PullRequestsControllerBase extends ControllerBase {
|
||||
hasWritePermission(owner, repoName, context.loginAccount))
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch pull request contents into refs/pull/${issueId}/head and return the head commit id of the pull request.
|
||||
*/
|
||||
private def fetchPullRequest(git: Git, issueId: Int, requestUserName: String, requestRepositoryName: String, requestBranch: String): String = {
|
||||
try {
|
||||
git.fetch
|
||||
.setRemote(getRepositoryDir(requestUserName, requestRepositoryName).toURI.toString)
|
||||
.setRefSpecs(new RefSpec(s"refs/heads/${requestBranch}:refs/pull/${issueId}/head").setForceUpdate(true))
|
||||
.call
|
||||
} catch {
|
||||
case ex: Exception => // ignore
|
||||
}
|
||||
git.getRepository.resolve(s"refs/pull/${issueId}/head").getName
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user