mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
fix: lastmodificationTime equals #2223
This commit is contained in:
@@ -224,6 +224,10 @@ class DateInstant : Parcelable {
|
||||
return this.mInstant.isAfter(dateInstant.mInstant)
|
||||
}
|
||||
|
||||
fun isEquals(dateInstant: DateInstant): Boolean {
|
||||
return this.mInstant.isEqual(dateInstant.mInstant)
|
||||
}
|
||||
|
||||
fun compareTo(other: DateInstant): Int {
|
||||
return mInstant.compareTo(other.mInstant)
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import com.kunzisoft.keepass.database.element.node.NodeId
|
||||
import com.kunzisoft.keepass.database.element.node.NodeIdInt
|
||||
import com.kunzisoft.keepass.database.element.node.NodeIdUUID
|
||||
import com.kunzisoft.keepass.database.element.node.NodeVersioned
|
||||
import com.kunzisoft.keepass.database.exception.DuplicateUuidDatabaseException
|
||||
import com.kunzisoft.keepass.utils.readAllBytes
|
||||
import java.io.IOException
|
||||
import java.util.UUID
|
||||
@@ -486,8 +487,7 @@ class DatabaseKDBXMerger(private var database: DatabaseKDBX) {
|
||||
// Merge independently custom data
|
||||
mergeCustomData(entry.customData, entryToMerge.customData)
|
||||
// Merge by modification time
|
||||
if (entry.lastModificationTime.isBefore(entryToMerge.lastModificationTime)
|
||||
) {
|
||||
if (entry.lastModificationTime.isBefore(entryToMerge.lastModificationTime)) {
|
||||
// Update entry with databaseEntryToMerge and merge history
|
||||
addHistory(entry, entryToMerge)
|
||||
if (parentEntryToMerge == entry.parent) {
|
||||
@@ -498,10 +498,9 @@ class DatabaseKDBXMerger(private var database: DatabaseKDBX) {
|
||||
database.addEntryTo(entryToMerge, parentEntryToMerge)
|
||||
}
|
||||
}
|
||||
} else if (entry.lastModificationTime.isAfter(entryToMerge.lastModificationTime)
|
||||
) {
|
||||
} else if (entry.lastModificationTime.isAfter(entryToMerge.lastModificationTime)) {
|
||||
addHistory(entryToMerge, entry)
|
||||
} else {
|
||||
} else if (entry.lastModificationTime.isEquals(entryToMerge.lastModificationTime)) {
|
||||
// If it's the same modification time, simply move entry to the right location
|
||||
parentEntryToMerge?.let {
|
||||
database.removeEntryFrom(entry, entry.parent)
|
||||
@@ -567,8 +566,7 @@ class DatabaseKDBXMerger(private var database: DatabaseKDBX) {
|
||||
// Merge independently custom data
|
||||
mergeCustomData(group.customData, groupToMerge.customData)
|
||||
// Merge by modification time
|
||||
if (group.lastModificationTime.isBefore(groupToMerge.lastModificationTime)
|
||||
) {
|
||||
if (group.lastModificationTime.isBefore(groupToMerge.lastModificationTime)) {
|
||||
if (parentGroupToMerge == group.parent) {
|
||||
group.updateWith(groupToMerge, false)
|
||||
} else {
|
||||
@@ -577,6 +575,12 @@ class DatabaseKDBXMerger(private var database: DatabaseKDBX) {
|
||||
database.addGroupTo(groupToMerge, parentGroupToMerge)
|
||||
}
|
||||
}
|
||||
} else if (group.lastModificationTime.isEquals(groupToMerge.lastModificationTime)) {
|
||||
// If it's the same modification time, simply move group to the right location
|
||||
parentGroupToMerge?.let {
|
||||
database.removeGroupFrom(group, group.parent)
|
||||
database.addGroupTo(groupToMerge, parentGroupToMerge)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user