diff: correctness
This commit is contained in:
parent
697c8faa67
commit
f560430efe
@ -46,6 +46,7 @@ type twoints struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Diff(o, n []string) []Instruction {
|
func Diff(o, n []string) []Instruction {
|
||||||
|
|
||||||
if len(o) == 0 && len(n) == 0 {
|
if len(o) == 0 && len(n) == 0 {
|
||||||
return []Instruction{}
|
return []Instruction{}
|
||||||
}
|
}
|
||||||
@ -91,9 +92,7 @@ func Diff(o, n []string) []Instruction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret := Diff(o[:omax], n[:nmax])
|
ret := Diff(o[:omax], n[:nmax])
|
||||||
if maxl != nmax {
|
ret = append(ret, Instruction{OP_UNCHANGED, n[nmax : nmax+maxl]})
|
||||||
ret = append(ret, Instruction{OP_UNCHANGED, n[nmax : maxl-nmax]})
|
|
||||||
}
|
|
||||||
ret = append(ret, Diff(o[omax+maxl:], n[nmax+maxl:])...)
|
ret = append(ret, Diff(o[omax+maxl:], n[nmax+maxl:])...)
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
Loading…
Reference in New Issue
Block a user