aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/format
diff options
context:
space:
mode:
authorPaulo Gomes <pjbgf@linux.com>2023-11-15 22:01:03 +0000
committerGitHub <noreply@github.com>2023-11-15 22:01:03 +0000
commit63b586b9559508baf7442c39db3327c91d37486c (patch)
treeddb2dbc15aaae84cad245a777282ab6f88517c35 /plumbing/format
parenteb1b04dbe45f7c9e866eb52e8ccccf3885a06217 (diff)
parentc3843453da23043b4a4dcb9f7968f72c1e4ae8cc (diff)
downloadgo-git-63b586b9559508baf7442c39db3327c91d37486c.tar.gz
Merge pull request #916 from aymanbagabas/trace
git: add tracer package
Diffstat (limited to 'plumbing/format')
-rw-r--r--plumbing/format/pktline/encoder.go4
-rw-r--r--plumbing/format/pktline/scanner.go3
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
}