Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c384345

Browse filesBrowse files
committed
plumbing: format/pktline: trace packets
1 parent a8e1735 commit c384345
Copy full SHA for c384345

File tree

Expand file treeCollapse file tree

2 files changed

+7
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+7
-0
lines changed

‎plumbing/format/pktline/encoder.go

Copy file name to clipboardExpand all lines: plumbing/format/pktline/encoder.go
+4Lines 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/internal/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

Copy file name to clipboardExpand all lines: plumbing/format/pktline/scanner.go
+3Lines 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/internal/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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.