MCPcopy Create free account
hub / github.com/go-git/go-git / encodeLine

Method encodeLine

plumbing/format/pktline/encoder.go:66–82  ·  view source on GitHub ↗
(p []byte)

Source from the content-addressed store, hash-verified

64}
65
66func (e *Encoder) encodeLine(p []byte) error {
67 if len(p) > MaxPayloadSize {
68 return ErrPayloadTooLong
69 }
70
71 if bytes.Equal(p, Flush) {
72 return e.Flush()
73 }
74
75 n := len(p) + 4
76 defer trace.Packet.Printf("packet: > %04x %s", n, p)
77 if _, err := e.w.Write(asciiHex16(n)); err != nil {
78 return err
79 }
80 _, err := e.w.Write(p)
81 return err
82}
83
84// Returns the hexadecimal ascii representation of the 16 less
85// significant bits of n. The length of the returned slice will always

Callers 1

EncodeMethod · 0.95

Calls 4

FlushMethod · 0.95
asciiHex16Function · 0.85
PrintfMethod · 0.80
WriteMethod · 0.45

Tested by

no test coverage detected