aboutsummaryrefslogtreecommitdiff
path: root/commitgraph/read/position.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 /commitgraph/read/position.go
parentnetwork/receivepack: Rename from receivepack (diff)
signatureNo signature
format: Move commitgraph and packfile here
Diffstat (limited to 'commitgraph/read/position.go')
-rw-r--r--commitgraph/read/position.go38
1 files changed, 0 insertions, 38 deletions
diff --git a/commitgraph/read/position.go b/commitgraph/read/position.go
deleted file mode 100644
index b2e1138b..00000000
--- a/commitgraph/read/position.go
+++ /dev/null
@@ -1,38 +0,0 @@
-package read
-
-import (
- "fmt"
-
- "codeberg.org/lindenii/furgit/internal/intconv"
-)
-
-// Position identifies one commit record by layer and row index.
-type Position struct {
- Graph uint32
- Index uint32
-}
-
-func (reader *Reader) globalToPosition(global uint32) (Position, error) {
- for i := range reader.layers {
- layer := &reader.layers[i]
- from := layer.globalFrom
-
- to := from + layer.numCommits
- if global >= from && global < to {
- graph, err := intconv.IntToUint32(i)
- if err != nil {
- return Position{}, err
- }
-
- return Position{
- Graph: graph,
- Index: global - from,
- }, nil
- }
- }
-
- return Position{}, &MalformedError{
- Path: "commit-graph",
- Reason: fmt.Sprintf("parent global position out of range: %d", global),
- }
-}