diff: remove some empty ins/del instructions
This commit is contained in:
parent
7c0a7af05f
commit
1938e659ab
10
diff/diff.go
10
diff/diff.go
@ -49,6 +49,12 @@ func Diff(o, n []string) []Instruction {
|
|||||||
if len(o) == 0 && len(n) == 0 {
|
if len(o) == 0 && len(n) == 0 {
|
||||||
return []Instruction{}
|
return []Instruction{}
|
||||||
}
|
}
|
||||||
|
if len(o) == 0 {
|
||||||
|
return []Instruction{{OP_INSERTED, n}}
|
||||||
|
}
|
||||||
|
if len(n) == 0 {
|
||||||
|
return []Instruction{{OP_REMOVED, o}}
|
||||||
|
}
|
||||||
|
|
||||||
maxl := 0
|
maxl := 0
|
||||||
omax := 0
|
omax := 0
|
||||||
@ -79,8 +85,8 @@ func Diff(o, n []string) []Instruction {
|
|||||||
|
|
||||||
if maxl == 0 {
|
if maxl == 0 {
|
||||||
return []Instruction{
|
return []Instruction{
|
||||||
Instruction{OP_REMOVED, o},
|
{OP_REMOVED, o},
|
||||||
Instruction{OP_INSERTED, n},
|
{OP_INSERTED, n},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user