Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
4503d2ea
Commit
4503d2ea
authored
6 years ago
by
Nikolay.Rykunov
Browse files
Options
Download
Email Patches
Plain Diff
Add tests for no-renames and partial merge diff log support
parent
2947a73a
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plugins/git4idea/tests/git4idea/log/GitLogUtilTest.kt
+37
-5
plugins/git4idea/tests/git4idea/log/GitLogUtilTest.kt
with
37 additions
and
5 deletions
+37
-5
plugins/git4idea/tests/git4idea/log/GitLogUtilTest.kt
+
37
-
5
View file @
4503d2ea
// Copyright 2000-201
8
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-201
9
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
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help