func applyError(err error, args ...interface{}) error {
	if err == nil {
		return nil
	}
	e, ok := err.(*ApplyError)
	if !ok {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
		e = &ApplyError{err: err}
	}
	for _, arg := range args {
		switch v := arg.(type) {
		case lineNum:
			e.Line = int64(v) + 1
		case fragNum:
			e.Fragment = int(v) + 1
		case fragLineNum:
			e.FragmentLine = int(v) + 1
		}
	}
	return e
}
applyError creates a new *ApplyError wrapping err or augments the information
in err with args if it is already an *ApplyError. Returns nil if err is nil.
package gitdiff
import (
	"errors"
	"fmt"
	"io"
	"sort"
)
type Conflict struct {
	msg string
}
func (c *Conflict) Error() string {
	return "conflict: " + c.msg
}
func (c *Conflict) Is(other error) bool {
	if other, ok := other.(*Conflict); ok {
		return other.msg == "" || other.msg == c.msg
	}
	return false
}
type ApplyError struct {
	Line int64
	Fragment int
	FragmentLine int
	err error
}
func (e *ApplyError) Unwrap() error {
	return e.err
}
func (e *ApplyError) Error() string {
	return fmt.Sprintf("%v", e.err)
}
type lineNum int
type fragNum int
type fragLineNum int