mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
[vcs-log] do not encode empty paths in vcs log indexes
GitOrigin-RevId: 7b97877edf0d12c2e5249ee0d83bc4e6a9e512da
This commit is contained in:
committed by
intellij-monorepo-bot
parent
aad4ab927e
commit
82b321c586
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package git4idea.history
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
@@ -31,14 +31,14 @@ internal class CompressedRecordBuilder(private val root: VirtualFile,
|
||||
private var renames = Int2IntOpenHashMap()
|
||||
|
||||
override fun addPath(type: Change.Type, firstPath: String, secondPath: String?) {
|
||||
if (secondPath != null) {
|
||||
if (!secondPath.isNullOrBlank() && firstPath.isNotBlank()) {
|
||||
val beforeId = pathsEncoder.encode(root, firstPath, false)
|
||||
val afterId = pathsEncoder.encode(root, secondPath, false)
|
||||
addPath(firstPath, beforeId, Change.Type.DELETED)
|
||||
addPath(secondPath, afterId, Change.Type.NEW)
|
||||
renames.put(beforeId, afterId)
|
||||
}
|
||||
else {
|
||||
else if (firstPath.isNotBlank()) {
|
||||
val pathId = pathsEncoder.encode(root, firstPath, false)
|
||||
addPath(firstPath, pathId, type)
|
||||
}
|
||||
@@ -51,14 +51,16 @@ internal class CompressedRecordBuilder(private val root: VirtualFile,
|
||||
|
||||
private fun addParents(path: String) {
|
||||
var parentPath = getParentPath(path)
|
||||
if (parentPath.isEmpty()) return
|
||||
|
||||
var parentPathId = pathsEncoder.encode(root, parentPath, true)
|
||||
|
||||
while (!parents.contains(parentPathId)) {
|
||||
if (parentPath.isEmpty()) break
|
||||
|
||||
parents.add(parentPathId)
|
||||
|
||||
parentPath = getParentPath(parentPath)
|
||||
if (parentPath.isEmpty()) break
|
||||
|
||||
parentPathId = pathsEncoder.encode(root, parentPath, true)
|
||||
}
|
||||
}
|
||||
@@ -90,4 +92,4 @@ internal class CompressedRecordBuilder(private val root: VirtualFile,
|
||||
internal class GitCompressedRecord(options: MutableMap<GitLogParser.GitLogOption, String>,
|
||||
val changes: Int2ObjectMap<Change.Type>,
|
||||
val renames: Int2IntMap,
|
||||
supportsRawBody: Boolean) : GitLogRecord(options, supportsRawBody)
|
||||
supportsRawBody: Boolean) : GitLogRecord(options, supportsRawBody)
|
||||
|
||||
Reference in New Issue
Block a user