From f8971c2fc1f9e993fe6a54b6bd3de12f4be5c2fc Mon Sep 17 00:00:00 2001 From: Julia Beliaeva Date: Fri, 14 Jun 2019 20:58:56 +0300 Subject: [PATCH] [file-history] ignore all changes except for moves IDEA-216289 GitOrigin-RevId: ed348f231b00e0335f468ee013fda3fea796aec8 --- .../src/git4idea/history/GitLogHistoryHandler.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/git4idea/src/git4idea/history/GitLogHistoryHandler.kt b/plugins/git4idea/src/git4idea/history/GitLogHistoryHandler.kt index 5b4f5d05cec2..1d483756a827 100644 --- a/plugins/git4idea/src/git4idea/history/GitLogHistoryHandler.kt +++ b/plugins/git4idea/src/git4idea/history/GitLogHistoryHandler.kt @@ -7,6 +7,7 @@ import com.intellij.openapi.project.Project import com.intellij.openapi.util.text.StringUtil import com.intellij.openapi.vcs.FilePath import com.intellij.openapi.vcs.VcsException +import com.intellij.openapi.vcs.changes.Change import com.intellij.openapi.vfs.VirtualFile import com.intellij.vcs.log.Hash import com.intellij.vcs.log.VcsLogFileHistoryHandler @@ -29,7 +30,13 @@ class GitLogHistoryHandler(private val project: Project) : VcsLogFileHistoryHand h.endOptions() h.addRelativePaths(filePath) - val recordBuilder = DefaultGitLogFullRecordBuilder() + val recordBuilder = object : DefaultGitLogFullRecordBuilder() { + override fun addPath(type: Change.Type, firstPath: String, secondPath: String?) { + if (type == Change.Type.MOVED) { + super.addPath(type, firstPath, secondPath) + } + } + } val parser = GitLogParser.PathsParser(GitLogParser.NameStatus.STATUS, recordBuilder) h.addLineListener { line, outputType -> if (outputType == ProcessOutputTypes.STDOUT) parser.parseLine(line) } Git.getInstance().runCommandWithoutCollectingOutput(h).throwOnError()