Commit 4503d2ea authored by Nikolay.Rykunov's avatar Nikolay.Rykunov
Browse files

Add tests for no-renames and partial merge diff log support

parent 2947a73a
No related merge requests found
Showing with 37 additions and 5 deletions
+37 -5
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package git4idea.log
import com.intellij.openapi.vcs.Executor.echo
......@@ -9,10 +9,7 @@ import com.intellij.vcs.log.VcsFullCommitDetails
import git4idea.GitCommit
import git4idea.config.GitVersion
import git4idea.history.GitLogUtil
import git4idea.test.GitSingleRepoTest
import git4idea.test.add
import git4idea.test.addCommit
import git4idea.test.last
import git4idea.test.*
import org.junit.Assume.assumeTrue
class GitLogUtilTest : GitSingleRepoTest() {
......@@ -57,4 +54,39 @@ class GitLogUtilTest : GitSingleRepoTest() {
assertEquals(expected, actualHashes)
}
@Throws(Exception::class)
fun `test readFullDetails without renames`() {
val details = ContainerUtil.newArrayList<VcsFullCommitDetails>()
touch("fileToRename.txt", "content")
repo.addCommit("Add fileToRename.txt")
git("mv fileToRename.txt renamedFile.txt")
repo.addCommit("Rename fileToRename.txt")
GitLogUtil.readFullDetails(myProject, repo.root, CollectConsumer(details), true, true, true, false, true)
val lastCommit = ContainerUtil.getFirstItem(details)
assertNotNull(lastCommit)
assertTrue(lastCommit!!.changes.all { !it.isRenamed })
}
@Throws(Exception::class)
fun `test readFullDetails without fullMergeDiff`() {
repo.checkoutNew("testBranch")
touch("fileToMerge1.txt", "content")
repo.addCommit("Add fileToMerge1.txt")
repo.checkout("master")
touch("fileToMerge2.txt", "content")
repo.addCommit("Add fileToMerge2.txt")
val success = git.merge(repo, "testBranch", mutableListOf("--no-ff")).success()
if (!success) {
fail("Could not do a merge")
}
val details = ContainerUtil.newArrayList<VcsFullCommitDetails>()
GitLogUtil.readFullDetails(myProject, repo.root, CollectConsumer(details), true, true, true, true, false)
val lastCommit = ContainerUtil.getFirstItem(details)
assertNotNull(lastCommit)
assertTrue(lastCommit!!.changes.isEmpty())
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment