diff options
author | Ayman Bagabas <ayman.bagabas@gmail.com> | 2023-11-15 16:53:42 -0500 |
---|---|---|
committer | Ayman Bagabas <ayman.bagabas@gmail.com> | 2023-11-15 16:53:42 -0500 |
commit | c3843453da23043b4a4dcb9f7968f72c1e4ae8cc (patch) | |
tree | ddb2dbc15aaae84cad245a777282ab6f88517c35 /plumbing | |
parent | a8e17350b8b1c97e252964c863fca0fac9ff5cec (diff) | |
download | go-git-c3843453da23043b4a4dcb9f7968f72c1e4ae8cc.tar.gz |
plumbing: format/pktline: trace packets
Diffstat (limited to 'plumbing')
-rw-r--r-- | plumbing/format/pktline/encoder.go | 4 | ||||
-rw-r--r-- | plumbing/format/pktline/scanner.go | 3 |
2 files changed, 7 insertions, 0 deletions
diff --git a/plumbing/format/pktline/encoder.go b/plumbing/format/pktline/encoder.go index 6d40979..1b9b84e 100644 --- a/plumbing/format/pktline/encoder.go +++ b/plumbing/format/pktline/encoder.go @@ -7,6 +7,8 @@ import ( "errors" "fmt" "io" + + "github.com/go-git/go-git/v5/internal/trace" ) // An Encoder writes pkt-lines to an output stream. @@ -43,6 +45,7 @@ func NewEncoder(w io.Writer) *Encoder { // Flush encodes a flush-pkt to the output stream. func (e *Encoder) Flush() error { + defer trace.Packet.Print("packet: > 0000") _, err := e.w.Write(FlushPkt) return err } @@ -70,6 +73,7 @@ func (e *Encoder) encodeLine(p []byte) error { } n := len(p) + 4 + defer trace.Packet.Printf("packet: > %04x %s", n, p) if _, err := e.w.Write(asciiHex16(n)); err != nil { return err } diff --git a/plumbing/format/pktline/scanner.go b/plumbing/format/pktline/scanner.go index 99aab46..86068af 100644 --- a/plumbing/format/pktline/scanner.go +++ b/plumbing/format/pktline/scanner.go @@ -3,6 +3,8 @@ package pktline import ( "errors" "io" + + "github.com/go-git/go-git/v5/internal/trace" ) const ( @@ -65,6 +67,7 @@ func (s *Scanner) Scan() bool { return false } s.payload = s.payload[:l] + trace.Packet.Printf("packet: < %04x %s", l, s.payload) return true } |