From c62c5544fa23378843a3383a9dcd4494e5ea33bc Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Fri, 6 Mar 2026 11:54:21 +0800 Subject: format/commitgraph: Split into ./read and ./ --- format/commitgraph/read/errors.go | 58 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 format/commitgraph/read/errors.go (limited to 'format/commitgraph/read/errors.go') diff --git a/format/commitgraph/read/errors.go b/format/commitgraph/read/errors.go new file mode 100644 index 00000000..9d0eca04 --- /dev/null +++ b/format/commitgraph/read/errors.go @@ -0,0 +1,58 @@ +package read + +import ( + "fmt" + + "codeberg.org/lindenii/furgit/objectid" +) + +// ErrNotFound reports a missing commit graph entry by object ID. +type ErrNotFound struct { + OID objectid.ObjectID +} + +// Error implements error. +func (err *ErrNotFound) Error() string { + return fmt.Sprintf("format/commitgraph: object not found: %s", err.OID) +} + +// ErrPositionOutOfRange reports an invalid graph position. +type ErrPositionOutOfRange struct { + Pos Position +} + +// Error implements error. +func (err *ErrPositionOutOfRange) Error() string { + return fmt.Sprintf("format/commitgraph: position out of range: graph=%d index=%d", err.Pos.Graph, err.Pos.Index) +} + +// ErrMalformed reports malformed commit-graph data. +type ErrMalformed struct { + Path string + Reason string +} + +// Error implements error. +func (err *ErrMalformed) Error() string { + return fmt.Sprintf("format/commitgraph: malformed %q: %s", err.Path, err.Reason) +} + +// ErrUnsupportedVersion reports unsupported commit-graph version. +type ErrUnsupportedVersion struct { + Version uint8 +} + +// Error implements error. +func (err *ErrUnsupportedVersion) Error() string { + return fmt.Sprintf("format/commitgraph: unsupported version %d", err.Version) +} + +// ErrBloomUnavailable reports missing changed-path bloom data at one position. +type ErrBloomUnavailable struct { + Pos Position +} + +// Error implements error. +func (err *ErrBloomUnavailable) Error() string { + return fmt.Sprintf("format/commitgraph: bloom unavailable at position graph=%d index=%d", err.Pos.Graph, err.Pos.Index) +} -- cgit v1.3.1-10-gc9f91