Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ plugins {
`maven-publish`
signing
kotlin("multiplatform") version "1.5.32"
kotlin("native.cocoapods") version "1.5.32"
}

repositories {
Expand Down
45 changes: 0 additions & 45 deletions kotlin_diff_utils.podspec

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ object UnifiedDiffUtils {
)
ret.addAll(curBlock)
deltas.clear()
deltas.add(nextDelta!!)
deltas.add(nextDelta)
}
delta = nextDelta
}
Expand Down
10 changes: 5 additions & 5 deletions src/commonMain/kotlin/dev/gitlive/difflib/patch/AbstractDelta.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@ abstract class AbstractDelta<T>(val type: DeltaType, val source: Chunk<T>, val t
return Triple(this.source, this.target, this.type).hashCode()
}

override fun equals(obj: Any?): Boolean {
if (this === obj) {
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
if (obj == null) {
if (other == null) {
return false
}
if (this::class != obj::class) {
if (this::class != other::class) {
return false
}
val other = obj as AbstractDelta<*>
val other = other as AbstractDelta<*>
if (source != other.source) {
return false
}
Expand Down
16 changes: 6 additions & 10 deletions src/commonMain/kotlin/dev/gitlive/difflib/patch/Chunk.kt
Original file line number Diff line number Diff line change
Expand Up @@ -120,22 +120,18 @@ class Chunk<T> {
return Triple(lines, position, size()).hashCode()
}

override fun equals(obj: Any?): Boolean {
if (this === obj) {
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
if (obj == null) {
if (other == null) {
return false
}
if (this::class != obj::class) {
if (this::class != other::class) {
return false
}
val other = obj as Chunk<*>?
if (lines == null) {
if (other!!.lines != null) {
return false
}
} else if (lines != other!!.lines) {
val other = other as Chunk<*>?
if (lines != other!!.lines) {
return false
}
return position == other.position
Expand Down
28 changes: 8 additions & 20 deletions src/commonMain/kotlin/dev/gitlive/difflib/text/DiffRow.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,36 +46,24 @@ class DiffRow(
return Triple(newLine, oldLine, tag).hashCode()
}

override fun equals(obj: Any?): Boolean {
if (this === obj) {
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
if (obj == null) {
if (other == null) {
return false
}
if (this::class != obj::class) {
if (this::class != other::class) {
return false
}
val other = obj as DiffRow
if (newLine == null) {
if (other.newLine != null) {
return false
}
} else if (newLine != other.newLine) {
val other = other as DiffRow
if (newLine != other.newLine) {
return false
}
if (oldLine == null) {
if (other.oldLine != null) {
return false
}
} else if (oldLine != other.oldLine) {
if (oldLine != other.oldLine) {
return false
}
if (tag == null) {
if (other.tag != null) {
return false
}
} else if (tag != other.tag) {
if (tag != other.tag) {
return false
}
return true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ internal object StringUtils {
* @param columnWidth the given column
* @return the wrapped text
*/
@OptIn(ExperimentalStdlibApi::class)
@kotlin.jvm.JvmStatic
fun wrapText(line: String, columnWidth: Int): String {
require(columnWidth >= 0) { "columnWidth may not be less 0" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class UnifiedDiff {
}

fun setTailTxt(tailTxt: String?) {
tail = tailTxt.takeUnless { it.isNullOrEmpty() }
tail = tailTxt
}

// @Throws(PatchFailedException::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,16 +182,18 @@ class UnifiedDiffReader internal constructor(lineReader: LineReader) {
}
}

var tailTxt = ""
line = nextLine()
while (line != null) {
if (tailTxt.isNotEmpty()) {
tailTxt += "\n"
if(line != null) {
var tailTxt = ""
while (line != null) {
if (tailTxt.isNotEmpty()) {
tailTxt += "\n"
}
tailTxt += line
line = nextLine()
}
tailTxt += line
line = nextLine()
data.setTailTxt(tailTxt)
}
data.setTailTxt(tailTxt)
return data
}

Expand Down