mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
git tests: skip tests on case-only rename commit for old Gits
In Git prior to 1.8.2 `git reset` used to return exit code 1, even if completes successfully. It affects only rare cases, so it was decided not to fix it: IDEA-182150
This commit is contained in:
@@ -22,7 +22,9 @@ import com.intellij.openapi.vcs.changes.Change
|
||||
import com.intellij.util.containers.ContainerUtil
|
||||
import git4idea.GitUtil
|
||||
import git4idea.checkin.GitCheckinEnvironment
|
||||
import git4idea.config.GitVersion
|
||||
import git4idea.test.*
|
||||
import org.junit.Assume.assumeTrue
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
@@ -133,6 +135,8 @@ class GitCommitTest : GitSingleRepoTest() {
|
||||
}
|
||||
|
||||
fun `test commit case rename & don't commit one staged file`() {
|
||||
`assume version where git reset returns 0 exit code on success `()
|
||||
|
||||
tac("s.java")
|
||||
generateCaseRename("a.java", "A.java")
|
||||
echo("s.java", "staged")
|
||||
@@ -157,6 +161,8 @@ class GitCommitTest : GitSingleRepoTest() {
|
||||
}
|
||||
|
||||
fun `test commit case rename & don't commit one staged simple rename, then rename should remain staged`() {
|
||||
`assume version where git reset returns 0 exit code on success `()
|
||||
|
||||
echo("before.txt", "some\ncontent\nere")
|
||||
addCommit("created before.txt")
|
||||
generateCaseRename("a.java", "A.java")
|
||||
@@ -181,6 +187,8 @@ class GitCommitTest : GitSingleRepoTest() {
|
||||
}
|
||||
|
||||
fun `test commit case rename + one unstaged file & don't commit one staged file`() {
|
||||
`assume version where git reset returns 0 exit code on success `()
|
||||
|
||||
tac("s.java")
|
||||
tac("m.java")
|
||||
generateCaseRename("a.java", "A.java")
|
||||
@@ -209,6 +217,8 @@ class GitCommitTest : GitSingleRepoTest() {
|
||||
}
|
||||
|
||||
fun `test commit case rename & don't commit a file which is both staged and unstaged, should reset and restore`() {
|
||||
`assume version where git reset returns 0 exit code on success `()
|
||||
|
||||
tac("c.java")
|
||||
generateCaseRename("a.java", "A.java")
|
||||
echo("c.java", "staged")
|
||||
@@ -267,6 +277,11 @@ class GitCommitTest : GitSingleRepoTest() {
|
||||
assertEquals(initialContent + additionalContent, git("show HEAD:A.java"))
|
||||
}
|
||||
|
||||
private fun `assume version where git reset returns 0 exit code on success `() {
|
||||
assumeTrue("Not testing: git reset returns 1 and fails the commit process in ${vcs.version}",
|
||||
vcs.version.isLaterOrEqual(GitVersion(1, 8, 2, 0)))
|
||||
}
|
||||
|
||||
private fun generateCaseRename(from: String, to: String) {
|
||||
tac(from)
|
||||
git("mv -f $from $to")
|
||||
|
||||
Reference in New Issue
Block a user