diff options
| author | 2026-03-10 13:30:48 +0800 | |
|---|---|---|
| committer | 2026-03-10 13:30:48 +0800 | |
| commit | 73e602a5c2c766caba59948e91c11122653705ec (patch) | |
| tree | 57951a4275dd90c2b3953e5b4bf3c9a7bd09b84a /format/commitgraph/read/position.go | |
| parent | *: Move sideband64k and pktline to protocol/ (diff) | |
| signature | No signature | |
commitgraph: Move out of format/
Diffstat (limited to 'format/commitgraph/read/position.go')
| -rw-r--r-- | format/commitgraph/read/position.go | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/format/commitgraph/read/position.go b/format/commitgraph/read/position.go deleted file mode 100644 index b2e1138b..00000000 --- a/format/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), - } -} |
