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)
| 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. |
| 141 | func 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 |
no test coverage detected