MCPcopy Create free account
hub / github.com/antonmedv/gitmal / applyBinaryDeltaAdd

Function applyBinaryDeltaAdd

pkg/gitdiff/apply_binary.go:141–148  ·  view source on GitHub ↗

applyBinaryDeltaAdd applies an add opcode in a delta-encoded binary fragment, returning the amount of data written and the usused part of the fragment. An add operation takes the form: [0xxxxxx][[data1]...] where the lower seven bits of the opcode is the number of data bytes following the opcode.

(w io.Writer, op byte, delta []byte)

Source from the content-addressed store, hash-verified

139// where the lower seven bits of the opcode is the number of data bytes
140// following the opcode. See also pack-format.txt in the Git source.
141func applyBinaryDeltaAdd(w io.Writer, op byte, delta []byte) (n int64, rest []byte, err error) {
142 size := int(op)
143 if len(delta) < size {
144 return 0, delta, errors.New("corrupt binary delta: incomplete add")
145 }
146 _, err = w.Write(delta[:size])
147 return int64(size), delta[size:], err
148}
149
150// applyBinaryDeltaCopy applies a copy opcode in a delta-encoded binary
151// fragment, returing the amount of data written and the unused part of the

Callers 1

applyBinaryDeltaFragmentFunction · 0.85

Calls 2

NewMethod · 0.80
WriteMethod · 0.80

Tested by

no test coverage detected