Fixed uncommited changes parent node lane position

This commit is contained in:
Abdelilah El Aissaoui 2021-10-30 19:38:11 +02:00
parent ba4c9596f8
commit b63614d68d

View File

@ -61,9 +61,11 @@ class GraphCommitList : RevCommitList<GraphNode>() {
}
override fun enter(index: Int, currCommit: GraphNode) {
var isUncommitedChangesNodeParent = false
if (currCommit.id == parentId) {
graphCommit.graphParent = currCommit
currCommit.addChild(graphCommit, addFirst = true)
isUncommitedChangesNodeParent = true
}
setupChildren(currCommit)
@ -100,6 +102,16 @@ class GraphCommitList : RevCommitList<GraphNode>() {
var reservedLane: GraphLane? = null
var childOnReservedLane: GraphNode? = null
var lengthOfReservedLane = -1
if (isUncommitedChangesNodeParent) {
val length = laneLength[graphCommit.lane]
if (length != null) {
reservedLane = graphCommit.lane
childOnReservedLane = graphCommit
lengthOfReservedLane = length
}
} else {
for (i in 0 until nChildren) {
val c: GraphNode = currCommit.children[i]
if (c.getGraphParent(0) === currCommit) {
@ -117,6 +129,7 @@ class GraphCommitList : RevCommitList<GraphNode>() {
}
}
}
}
if (reservedLane != null) {
currCommit.lane = reservedLane
laneLength[reservedLane] = Integer.valueOf(lengthOfReservedLane + 1)