aboutsummaryrefslogtreecommitdiff
path: root/packfile/ofs.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-26 09:17:14 +0000
committerGravatar Runxi Yu2026-03-26 09:18:30 +0000
commit3e884f5f3d42cbc4874a04da31dde10314b0cfad (patch)
treef5e1e325fd1a2a0801791c054010213214475d80 /packfile/ofs.go
parentnetwork/receivepack: Rename from receivepack (diff)
signatureNo signature
format: Move commitgraph and packfile here
Diffstat (limited to 'packfile/ofs.go')
-rw-r--r--packfile/ofs.go26
1 files changed, 0 insertions, 26 deletions
diff --git a/packfile/ofs.go b/packfile/ofs.go
deleted file mode 100644
index 4992a506..00000000
--- a/packfile/ofs.go
+++ /dev/null
@@ -1,26 +0,0 @@
-package packfile
-
-import "fmt"
-
-// ParseOfsDeltaDistance parses one ofs-delta backward distance.
-func ParseOfsDeltaDistance(buf []byte) (uint64, int, error) {
- if len(buf) == 0 {
- return 0, 0, fmt.Errorf("packfile: malformed ofs-delta distance")
- }
-
- b := buf[0]
- dist := uint64(b & 0x7f)
-
- consumed := 1
- for b&0x80 != 0 {
- if consumed >= len(buf) {
- return 0, 0, fmt.Errorf("packfile: malformed ofs-delta distance")
- }
-
- b = buf[consumed]
- consumed++
- dist = ((dist + 1) << 7) + uint64(b&0x7f)
- }
-
- return dist, consumed, nil
-}