Handle FileDel hunks

andybalholm
Apr 6, 2023, 11:55 PM
HCMPNVNHXZHOAOJ7JI7UCPNMFBLV23ZCMYUBIUWX6PBSTOZ7RW7AC

Dependencies

Change contents

  • edit in hunk.go at line 189
    [4.3409]
    [4.3409]
    case 1:
    return fileDel(data)
  • edit in hunk.go at line 329
    [2.2382]
    [2.2382]
    }
    type FileDel struct {
    Del Atom
    Contents Atom
    Path string
    Encoding string
  • edit in hunk.go at line 337
    [2.2384]
    func (f FileDel) atoms() []Atom {
    if f.Contents == nil {
    return []Atom{f.Del}
    }
    return []Atom{f.Del, f.Contents}
    }
    func fileDel(data []byte) ([]byte, FileDel, error) {
    var f FileDel
    data, _, err := tuple(
    assign(&f.Del, atom),
    assign(&f.Contents, mapValue(option(atom), func(p *Atom) Atom {
    if p == nil {
    return nil
    }
    return *p
    })),
    assign(&f.Path, toString(lengthData(uint64LE))),
    assign(&f.Encoding, mapValue(option(toString(lengthData(uint64LE))), func(p *string) string {
    if p == nil {
    return ""
    }
    return *p
    })),
    )(data)
    return data, f, err
    }