mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-07 22:15:51 +01:00
Fix message
This commit is contained in:
@@ -216,7 +216,7 @@ object MergeService{
|
||||
throw new RuntimeException("This pull request can't merge automatically.")
|
||||
}
|
||||
val mergeResultCommit = parseCommit(Option(repository.resolve(mergedBranchName)).getOrElse {
|
||||
throw new RuntimeException(s"not found branch ${mergedBranchName}")
|
||||
throw new RuntimeException(s"Not found branch ${mergedBranchName}")
|
||||
})
|
||||
// creates merge commit
|
||||
val mergeCommitId = createMergeCommit(mergeResultCommit.getTree().getId(), committer, message)
|
||||
@@ -295,7 +295,7 @@ object MergeService{
|
||||
private def createConflictMessage(mergeTip: ObjectId, mergeBaseTip: ObjectId, merger: Merger): String = {
|
||||
val mergeResults = merger.asInstanceOf[RecursiveMerger].getMergeResults
|
||||
|
||||
s"can't merge ${mergeTip.name} into ${mergeBaseTip.name}\n\n" +
|
||||
s"Can't merge ${mergeTip.name} into ${mergeBaseTip.name}\n\n" +
|
||||
"Conflicting files:\n" +
|
||||
mergeResults.asScala.map { case (key, _) => "- " + key + "\n" }.mkString
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class MergeServiceSpec extends FunSpec {
|
||||
val repo1Dir = initRepository("user1","repo1")
|
||||
assert(service.checkConflictCache("user1", "repo1", branch, issueId) == None)
|
||||
val conflicted = service.checkConflict("user1", "repo1", branch, issueId)
|
||||
assert(service.checkConflictCache("user1", "repo1", branch, issueId) == Some(false))
|
||||
assert(service.checkConflictCache("user1", "repo1", branch, issueId) == Some(None))
|
||||
assert(conflicted.isEmpty)
|
||||
}
|
||||
it("checkConflict true if not conflicted, and create cache") {
|
||||
@@ -43,14 +43,17 @@ class MergeServiceSpec extends FunSpec {
|
||||
assert(service.checkConflictCache("user1", "repo2", branch, issueId) == None)
|
||||
val conflicted = service.checkConflict("user1", "repo2", branch, issueId)
|
||||
assert(conflicted.isDefined)
|
||||
assert(service.checkConflictCache("user1", "repo2", branch, issueId) == Some(true))
|
||||
assert(service.checkConflictCache("user1", "repo2", branch, issueId) match {
|
||||
case Some(Some(_: String)) => true
|
||||
case _ => false
|
||||
})
|
||||
}
|
||||
}
|
||||
describe("checkConflictCache") {
|
||||
it("merged cache invalid if origin branch moved") {
|
||||
val repo3Dir = initRepository("user1","repo3")
|
||||
assert(service.checkConflict("user1", "repo3", branch, issueId) == false)
|
||||
assert(service.checkConflictCache("user1", "repo3", branch, issueId) == Some(false))
|
||||
assert(service.checkConflict("user1", "repo3", branch, issueId).isEmpty)
|
||||
assert(service.checkConflictCache("user1", "repo3", branch, issueId) == Some(None))
|
||||
using(Git.open(repo3Dir)){ git =>
|
||||
createFile(git, s"refs/heads/${branch}", "test.txt", "hoge2" )
|
||||
}
|
||||
@@ -58,8 +61,8 @@ class MergeServiceSpec extends FunSpec {
|
||||
}
|
||||
it("merged cache invalid if request branch moved") {
|
||||
val repo4Dir = initRepository("user1","repo4")
|
||||
assert(service.checkConflict("user1", "repo4", branch, issueId) == false)
|
||||
assert(service.checkConflictCache("user1", "repo4", branch, issueId) == Some(false))
|
||||
assert(service.checkConflict("user1", "repo4", branch, issueId).isEmpty)
|
||||
assert(service.checkConflictCache("user1", "repo4", branch, issueId) == Some(None))
|
||||
using(Git.open(repo4Dir)){ git =>
|
||||
createFile(git, s"refs/pull/${issueId}/head", "test.txt", "hoge4" )
|
||||
}
|
||||
@@ -67,8 +70,8 @@ class MergeServiceSpec extends FunSpec {
|
||||
}
|
||||
it("should merged cache invalid if origin branch moved") {
|
||||
val repo5Dir = initRepository("user1","repo5")
|
||||
assert(service.checkConflict("user1", "repo5", branch, issueId) == false)
|
||||
assert(service.checkConflictCache("user1", "repo5", branch, issueId) == Some(false))
|
||||
assert(service.checkConflict("user1", "repo5", branch, issueId).isEmpty)
|
||||
assert(service.checkConflictCache("user1", "repo5", branch, issueId) == Some(None))
|
||||
using(Git.open(repo5Dir)){ git =>
|
||||
createFile(git, s"refs/heads/${branch}", "test.txt", "hoge2" )
|
||||
}
|
||||
@@ -79,8 +82,11 @@ class MergeServiceSpec extends FunSpec {
|
||||
using(Git.open(repo6Dir)){ git =>
|
||||
createConfrict(git)
|
||||
}
|
||||
assert(service.checkConflict("user1", "repo6", branch, issueId) == true)
|
||||
assert(service.checkConflictCache("user1", "repo6", branch, issueId) == Some(true))
|
||||
assert(service.checkConflict("user1", "repo6", branch, issueId).isDefined)
|
||||
assert(service.checkConflictCache("user1", "repo6", branch, issueId) match {
|
||||
case Some(Some(_: String)) => true
|
||||
case _ => false
|
||||
})
|
||||
using(Git.open(repo6Dir)){ git =>
|
||||
createFile(git, s"refs/pull/${issueId}/head", "test.txt", "hoge4" )
|
||||
}
|
||||
@@ -91,8 +97,11 @@ class MergeServiceSpec extends FunSpec {
|
||||
using(Git.open(repo7Dir)){ git =>
|
||||
createConfrict(git)
|
||||
}
|
||||
assert(service.checkConflict("user1", "repo7", branch, issueId) == true)
|
||||
assert(service.checkConflictCache("user1", "repo7", branch, issueId) == Some(true))
|
||||
assert(service.checkConflict("user1", "repo7", branch, issueId).isDefined)
|
||||
assert(service.checkConflictCache("user1", "repo7", branch, issueId) match {
|
||||
case Some(Some(_)) => true
|
||||
case _ => false
|
||||
})
|
||||
using(Git.open(repo7Dir)){ git =>
|
||||
createFile(git, s"refs/heads/${branch}", "test.txt", "hoge4" )
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user