MCPcopy Index your code
hub / github.com/go-git/go-git / encodeRawExtension

Method encodeRawExtension

plumbing/format/index/encoder.go:196–217  ·  view source on GitHub ↗
(signature string, data []byte)

Source from the content-addressed store, hash-verified

194}
195
196func (e *Encoder) encodeRawExtension(signature string, data []byte) error {
197 if len(signature) != 4 {
198 return fmt.Errorf("invalid signature length")
199 }
200
201 _, err := e.w.Write([]byte(signature))
202 if err != nil {
203 return err
204 }
205
206 err = binary.WriteUint32(e.w, uint32(len(data)))
207 if err != nil {
208 return err
209 }
210
211 _, err = e.w.Write(data)
212 if err != nil {
213 return err
214 }
215
216 return nil
217}
218
219func (e *Encoder) timeToUint32(t *time.Time) (uint32, uint32, error) {
220 if t.IsZero() {

Callers 2

TestDecodeInvalidHashMethod · 0.95

Calls 2

WriteUint32Function · 0.92
WriteMethod · 0.45

Tested by 2

TestDecodeInvalidHashMethod · 0.76