Skip to content

Commit 21d9676

Browse files
committed
git: trace pktline operations
1 parent 08a85a3 commit 21d9676

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

plumbing/format/pktline/encoder.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import (
77
"errors"
88
"fmt"
99
"io"
10+
11+
"github.com/go-git/go-git/v5/utils/trace"
1012
)
1113

1214
// An Encoder writes pkt-lines to an output stream.
@@ -43,6 +45,7 @@ func NewEncoder(w io.Writer) *Encoder {
4345

4446
// Flush encodes a flush-pkt to the output stream.
4547
func (e *Encoder) Flush() error {
48+
defer trace.Packet.Print("packet: > 0000")
4649
_, err := e.w.Write(FlushPkt)
4750
return err
4851
}
@@ -70,6 +73,7 @@ func (e *Encoder) encodeLine(p []byte) error {
7073
}
7174

7275
n := len(p) + 4
76+
defer trace.Packet.Printf("packet: > %04x %s", n, p)
7377
if _, err := e.w.Write(asciiHex16(n)); err != nil {
7478
return err
7579
}

plumbing/format/pktline/scanner.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package pktline
33
import (
44
"errors"
55
"io"
6+
7+
"github.com/go-git/go-git/v5/utils/trace"
68
)
79

810
const (
@@ -65,6 +67,7 @@ func (s *Scanner) Scan() bool {
6567
return false
6668
}
6769
s.payload = s.payload[:l]
70+
trace.Packet.Printf("packet: < %04x %s", l, s.payload)
6871

6972
return true
7073
}

0 commit comments

Comments
 (0)