aboutsummaryrefslogtreecommitdiff
path: root/format/commitgraph/read
diff options
context:
space:
mode:
Diffstat (limited to 'format/commitgraph/read')
-rw-r--r--format/commitgraph/read/bloom.go8
-rw-r--r--format/commitgraph/read/edges.go4
-rw-r--r--format/commitgraph/read/errors.go30
-rw-r--r--format/commitgraph/read/generation.go2
-rw-r--r--format/commitgraph/read/hash.go10
-rw-r--r--format/commitgraph/read/layer_open.go2
-rw-r--r--format/commitgraph/read/layer_parse.go46
-rw-r--r--format/commitgraph/read/layer_pos.go4
-rw-r--r--format/commitgraph/read/lookup.go4
-rw-r--r--format/commitgraph/read/open_chain.go10
-rw-r--r--format/commitgraph/read/parents.go4
-rw-r--r--format/commitgraph/read/position.go2
-rw-r--r--format/commitgraph/read/read_test.go8
13 files changed, 67 insertions, 67 deletions
diff --git a/format/commitgraph/read/bloom.go b/format/commitgraph/read/bloom.go
index 9b66f458..e00b800f 100644
--- a/format/commitgraph/read/bloom.go
+++ b/format/commitgraph/read/bloom.go
@@ -38,7 +38,7 @@ func (reader *Reader) BloomVersion() uint8 {
// BloomFilterAt returns one commit's changed-path Bloom filter.
//
-// Returns ErrBloomUnavailable when this commit graph has no Bloom data.
+// Returns BloomUnavailableError when this commit graph has no Bloom data.
func (reader *Reader) BloomFilterAt(pos Position) (*bloom.Filter, error) {
layer, err := reader.layerByPosition(pos)
if err != nil {
@@ -46,7 +46,7 @@ func (reader *Reader) BloomFilterAt(pos Position) (*bloom.Filter, error) {
}
if layer.chunkBloomIndex == nil || layer.chunkBloomData == nil || layer.bloomSettings == nil {
- return nil, &ErrBloomUnavailable{Pos: pos}
+ return nil, &BloomUnavailableError{Pos: pos}
}
start, end, err := bloomRange(layer, pos.Index)
@@ -86,7 +86,7 @@ func bloomRange(layer *layer, commitIndex uint32) (int, int, error) {
}
if end < start {
- return 0, 0, &ErrMalformed{Path: layer.path, Reason: "invalid BIDX range"}
+ return 0, 0, &MalformedError{Path: layer.path, Reason: "invalid BIDX range"}
}
bdatLen := len(layer.chunkBloomData) - bloom.DataHeaderSize
@@ -97,7 +97,7 @@ func bloomRange(layer *layer, commitIndex uint32) (int, int, error) {
}
if end > bdatLenU32 {
- return 0, 0, &ErrMalformed{Path: layer.path, Reason: "BIDX range out of BDAT bounds"}
+ return 0, 0, &MalformedError{Path: layer.path, Reason: "BIDX range out of BDAT bounds"}
}
startInt, err := intconv.Uint64ToInt(uint64(start))
diff --git a/format/commitgraph/read/edges.go b/format/commitgraph/read/edges.go
index de8bab60..96ffeb6d 100644
--- a/format/commitgraph/read/edges.go
+++ b/format/commitgraph/read/edges.go
@@ -9,7 +9,7 @@ import (
func (reader *Reader) decodeExtraEdgeList(layer *layer, edgeStart uint32) ([]Position, error) {
if len(layer.chunkExtraEdges) == 0 {
- return nil, &ErrMalformed{Path: layer.path, Reason: "missing EDGE chunk"}
+ return nil, &MalformedError{Path: layer.path, Reason: "missing EDGE chunk"}
}
out := make([]Position, 0)
@@ -24,7 +24,7 @@ func (reader *Reader) decodeExtraEdgeList(layer *layer, edgeStart uint32) ([]Pos
}
if off+4 > len(layer.chunkExtraEdges) {
- return nil, &ErrMalformed{Path: layer.path, Reason: "EDGE index out of range"}
+ return nil, &MalformedError{Path: layer.path, Reason: "EDGE index out of range"}
}
word := binary.BigEndian.Uint32(layer.chunkExtraEdges[off : off+4])
diff --git a/format/commitgraph/read/errors.go b/format/commitgraph/read/errors.go
index 9d0eca04..8dd02a60 100644
--- a/format/commitgraph/read/errors.go
+++ b/format/commitgraph/read/errors.go
@@ -6,53 +6,53 @@ import (
"codeberg.org/lindenii/furgit/objectid"
)
-// ErrNotFound reports a missing commit graph entry by object ID.
-type ErrNotFound struct {
+// NotFoundError reports a missing commit graph entry by object ID.
+type NotFoundError struct {
OID objectid.ObjectID
}
// Error implements error.
-func (err *ErrNotFound) Error() string {
+func (err *NotFoundError) Error() string {
return fmt.Sprintf("format/commitgraph: object not found: %s", err.OID)
}
-// ErrPositionOutOfRange reports an invalid graph position.
-type ErrPositionOutOfRange struct {
+// PositionOutOfRangeError reports an invalid graph position.
+type PositionOutOfRangeError struct {
Pos Position
}
// Error implements error.
-func (err *ErrPositionOutOfRange) Error() string {
+func (err *PositionOutOfRangeError) 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 {
+// MalformedError reports malformed commit-graph data.
+type MalformedError struct {
Path string
Reason string
}
// Error implements error.
-func (err *ErrMalformed) Error() string {
+func (err *MalformedError) Error() string {
return fmt.Sprintf("format/commitgraph: malformed %q: %s", err.Path, err.Reason)
}
-// ErrUnsupportedVersion reports unsupported commit-graph version.
-type ErrUnsupportedVersion struct {
+// UnsupportedVersionError reports unsupported commit-graph version.
+type UnsupportedVersionError struct {
Version uint8
}
// Error implements error.
-func (err *ErrUnsupportedVersion) Error() string {
+func (err *UnsupportedVersionError) 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 {
+// BloomUnavailableError reports missing changed-path bloom data at one position.
+type BloomUnavailableError struct {
Pos Position
}
// Error implements error.
-func (err *ErrBloomUnavailable) Error() string {
+func (err *BloomUnavailableError) Error() string {
return fmt.Sprintf("format/commitgraph: bloom unavailable at position graph=%d index=%d", err.Pos.Graph, err.Pos.Index)
}
diff --git a/format/commitgraph/read/generation.go b/format/commitgraph/read/generation.go
index d1f0ebe7..62e47996 100644
--- a/format/commitgraph/read/generation.go
+++ b/format/commitgraph/read/generation.go
@@ -34,7 +34,7 @@ func (reader *Reader) readGenerationV2(layer *layer, index uint32, commitTime ui
}
if gdo2Off+8 > len(layer.chunkGenerationOv) {
- return 0, &ErrMalformed{Path: layer.path, Reason: "GDO2 index out of range"}
+ return 0, &MalformedError{Path: layer.path, Reason: "GDO2 index out of range"}
}
overflow := binary.BigEndian.Uint64(layer.chunkGenerationOv[gdo2Off : gdo2Off+8])
diff --git a/format/commitgraph/read/hash.go b/format/commitgraph/read/hash.go
index 3f30df91..e9543eac 100644
--- a/format/commitgraph/read/hash.go
+++ b/format/commitgraph/read/hash.go
@@ -16,7 +16,7 @@ func (reader *Reader) HashVersion() uint8 {
func validateChainBaseHashes(algo objectid.Algorithm, chain []string, idx int, graph *layer) error {
if idx == 0 {
if len(graph.chunkBaseGraphs) != 0 {
- return &ErrMalformed{Path: graph.path, Reason: "unexpected BASE chunk in first graph"}
+ return &MalformedError{Path: graph.path, Reason: "unexpected BASE chunk in first graph"}
}
return nil
@@ -26,7 +26,7 @@ func validateChainBaseHashes(algo objectid.Algorithm, chain []string, idx int, g
expectedLen := idx * hashSize
if len(graph.chunkBaseGraphs) != expectedLen {
- return &ErrMalformed{
+ return &MalformedError{
Path: graph.path,
Reason: fmt.Sprintf("BASE chunk length %d does not match expected %d", len(graph.chunkBaseGraphs), expectedLen),
}
@@ -42,7 +42,7 @@ func validateChainBaseHashes(algo objectid.Algorithm, chain []string, idx int, g
}
if baseHash.String() != chain[i] {
- return &ErrMalformed{
+ return &MalformedError{
Path: graph.path,
Reason: fmt.Sprintf("BASE chunk mismatch at index %d", i),
}
@@ -55,7 +55,7 @@ func validateChainBaseHashes(algo objectid.Algorithm, chain []string, idx int, g
func verifyTrailerHash(data []byte, algo objectid.Algorithm, path string) error {
hashSize := algo.Size()
if len(data) < hashSize {
- return &ErrMalformed{Path: path, Reason: "file too short for trailer"}
+ return &MalformedError{Path: path, Reason: "file too short for trailer"}
}
hashImpl, err := algo.New()
@@ -72,7 +72,7 @@ func verifyTrailerHash(data []byte, algo objectid.Algorithm, path string) error
want := data[len(data)-hashSize:]
if !bytes.Equal(got, want) {
- return &ErrMalformed{Path: path, Reason: "trailer hash mismatch"}
+ return &MalformedError{Path: path, Reason: "trailer hash mismatch"}
}
return nil
diff --git a/format/commitgraph/read/layer_open.go b/format/commitgraph/read/layer_open.go
index bf126960..1190108e 100644
--- a/format/commitgraph/read/layer_open.go
+++ b/format/commitgraph/read/layer_open.go
@@ -26,7 +26,7 @@ func openLayer(root *os.Root, relPath string, algo objectid.Algorithm) (*layer,
if size < int64(commitgraph.HeaderSize+commitgraph.FanoutSize+algo.Size()) {
_ = file.Close()
- return nil, &ErrMalformed{Path: relPath, Reason: "file too short"}
+ return nil, &MalformedError{Path: relPath, Reason: "file too short"}
}
mapLen, err := intconv.Int64ToUint64(size)
diff --git a/format/commitgraph/read/layer_parse.go b/format/commitgraph/read/layer_parse.go
index dca9f416..b615010f 100644
--- a/format/commitgraph/read/layer_parse.go
+++ b/format/commitgraph/read/layer_parse.go
@@ -11,19 +11,19 @@ import (
func parseLayer(layer *layer, algo objectid.Algorithm) error { //nolint:maintidx
if len(layer.data) < commitgraph.HeaderSize {
- return &ErrMalformed{Path: layer.path, Reason: "file too short"}
+ return &MalformedError{Path: layer.path, Reason: "file too short"}
}
header := layer.data[:commitgraph.HeaderSize]
signature := binary.BigEndian.Uint32(header[:4])
if signature != commitgraph.FileSignature {
- return &ErrMalformed{Path: layer.path, Reason: "invalid signature"}
+ return &MalformedError{Path: layer.path, Reason: "invalid signature"}
}
version := header[4]
if version != commitgraph.FileVersion {
- return &ErrUnsupportedVersion{Version: version}
+ return &UnsupportedVersionError{Version: version}
}
expectedHashVersion, err := intconv.Uint32ToUint8(algo.PackHashID())
@@ -33,7 +33,7 @@ func parseLayer(layer *layer, algo objectid.Algorithm) error { //nolint:maintidx
hashVersion := header[5]
if hashVersion != expectedHashVersion {
- return &ErrMalformed{Path: layer.path, Reason: "hash version does not match object format"}
+ return &MalformedError{Path: layer.path, Reason: "hash version does not match object format"}
}
numChunks := int(header[6])
@@ -44,7 +44,7 @@ func parseLayer(layer *layer, algo objectid.Algorithm) error { //nolint:maintidx
tocEnd := tocStart + tocLen
if tocEnd > len(layer.data) {
- return &ErrMalformed{Path: layer.path, Reason: "truncated chunk table"}
+ return &MalformedError{Path: layer.path, Reason: "truncated chunk table"}
}
type tocEntry struct {
@@ -65,7 +65,7 @@ func parseLayer(layer *layer, algo objectid.Algorithm) error { //nolint:maintidx
}
if entries[len(entries)-1].id != 0 {
- return &ErrMalformed{Path: layer.path, Reason: "missing chunk table terminator"}
+ return &MalformedError{Path: layer.path, Reason: "missing chunk table terminator"}
}
trailerStart := len(layer.data) - algo.Size()
@@ -74,7 +74,7 @@ func parseLayer(layer *layer, algo objectid.Algorithm) error { //nolint:maintidx
for i := range numChunks {
entry := entries[i]
if entry.id == 0 {
- return &ErrMalformed{Path: layer.path, Reason: "early chunk table terminator"}
+ return &MalformedError{Path: layer.path, Reason: "early chunk table terminator"}
}
next := entries[i+1]
@@ -90,11 +90,11 @@ func parseLayer(layer *layer, algo objectid.Algorithm) error { //nolint:maintidx
}
if start < tocEnd || end < start || end > trailerStart {
- return &ErrMalformed{Path: layer.path, Reason: "invalid chunk offsets"}
+ return &MalformedError{Path: layer.path, Reason: "invalid chunk offsets"}
}
if _, exists := chunks[entry.id]; exists {
- return &ErrMalformed{Path: layer.path, Reason: "duplicate chunk id"}
+ return &MalformedError{Path: layer.path, Reason: "duplicate chunk id"}
}
chunks[entry.id] = layer.data[start:end]
@@ -102,7 +102,7 @@ func parseLayer(layer *layer, algo objectid.Algorithm) error { //nolint:maintidx
oidf := chunks[commitgraph.ChunkOIDF]
if len(oidf) != commitgraph.FanoutSize {
- return &ErrMalformed{Path: layer.path, Reason: "invalid OIDF length"}
+ return &MalformedError{Path: layer.path, Reason: "invalid OIDF length"}
}
layer.chunkOIDFanout = oidf
@@ -113,7 +113,7 @@ func parseLayer(layer *layer, algo objectid.Algorithm) error { //nolint:maintidx
next := binary.BigEndian.Uint32(oidf[(i+1)*4 : (i+2)*4])
if cur > next {
- return &ErrMalformed{Path: layer.path, Reason: "non-monotonic OIDF fanout"}
+ return &MalformedError{Path: layer.path, Reason: "non-monotonic OIDF fanout"}
}
}
@@ -133,7 +133,7 @@ func parseLayer(layer *layer, algo objectid.Algorithm) error { //nolint:maintidx
}
if len(oidl) != oidlWantLen {
- return &ErrMalformed{Path: layer.path, Reason: "invalid OIDL length"}
+ return &MalformedError{Path: layer.path, Reason: "invalid OIDL length"}
}
layer.chunkOIDLookup = oidl
@@ -154,7 +154,7 @@ func parseLayer(layer *layer, algo objectid.Algorithm) error { //nolint:maintidx
}
if len(cdat) != cdatWantLen {
- return &ErrMalformed{Path: layer.path, Reason: "invalid CDAT length"}
+ return &MalformedError{Path: layer.path, Reason: "invalid CDAT length"}
}
layer.chunkCommit = cdat
@@ -169,7 +169,7 @@ func parseLayer(layer *layer, algo objectid.Algorithm) error { //nolint:maintidx
}
if len(gda2) != wantLen {
- return &ErrMalformed{Path: layer.path, Reason: "invalid GDA2 length"}
+ return &MalformedError{Path: layer.path, Reason: "invalid GDA2 length"}
}
layer.chunkGeneration = gda2
@@ -178,7 +178,7 @@ func parseLayer(layer *layer, algo objectid.Algorithm) error { //nolint:maintidx
gdo2 := chunks[commitgraph.ChunkGDO2]
if len(gdo2) != 0 {
if len(gdo2)%8 != 0 {
- return &ErrMalformed{Path: layer.path, Reason: "invalid GDO2 length"}
+ return &MalformedError{Path: layer.path, Reason: "invalid GDO2 length"}
}
layer.chunkGenerationOv = gdo2
@@ -187,7 +187,7 @@ func parseLayer(layer *layer, algo objectid.Algorithm) error { //nolint:maintidx
edge := chunks[commitgraph.ChunkEDGE]
if len(edge) != 0 {
if len(edge)%4 != 0 {
- return &ErrMalformed{Path: layer.path, Reason: "invalid EDGE length"}
+ return &MalformedError{Path: layer.path, Reason: "invalid EDGE length"}
}
layer.chunkExtraEdges = edge
@@ -196,7 +196,7 @@ func parseLayer(layer *layer, algo objectid.Algorithm) error { //nolint:maintidx
base := chunks[commitgraph.ChunkBASE]
if baseCount == 0 {
if len(base) != 0 {
- return &ErrMalformed{Path: layer.path, Reason: "unexpected BASE chunk"}
+ return &MalformedError{Path: layer.path, Reason: "unexpected BASE chunk"}
}
} else {
wantLen64 := uint64(baseCount) * hashSizeU64
@@ -207,7 +207,7 @@ func parseLayer(layer *layer, algo objectid.Algorithm) error { //nolint:maintidx
}
if len(base) != wantLen {
- return &ErrMalformed{Path: layer.path, Reason: "invalid BASE length"}
+ return &MalformedError{Path: layer.path, Reason: "invalid BASE length"}
}
layer.chunkBaseGraphs = base
@@ -220,7 +220,7 @@ func parseLayer(layer *layer, algo objectid.Algorithm) error { //nolint:maintidx
bdat := chunks[commitgraph.ChunkBDAT]
if len(bidx) != 0 || len(bdat) != 0 { //nolint:nestif
if len(bidx) == 0 || len(bdat) == 0 {
- return &ErrMalformed{Path: layer.path, Reason: "BIDX/BDAT must both be present"}
+ return &MalformedError{Path: layer.path, Reason: "BIDX/BDAT must both be present"}
}
bidxWantLen64 := uint64(layer.numCommits) * 4
@@ -231,11 +231,11 @@ func parseLayer(layer *layer, algo objectid.Algorithm) error { //nolint:maintidx
}
if len(bidx) != bidxWantLen {
- return &ErrMalformed{Path: layer.path, Reason: "invalid BIDX length"}
+ return &MalformedError{Path: layer.path, Reason: "invalid BIDX length"}
}
if len(bdat) < bloom.DataHeaderSize {
- return &ErrMalformed{Path: layer.path, Reason: "invalid BDAT length"}
+ return &MalformedError{Path: layer.path, Reason: "invalid BDAT length"}
}
settings, err := bloom.ParseSettings(bdat)
@@ -250,7 +250,7 @@ func parseLayer(layer *layer, algo objectid.Algorithm) error { //nolint:maintidx
cur := binary.BigEndian.Uint32(bidx[off : off+4])
if i > 0 && cur < prev {
- return &ErrMalformed{Path: layer.path, Reason: "non-monotonic BIDX"}
+ return &MalformedError{Path: layer.path, Reason: "non-monotonic BIDX"}
}
bdatDataLen := len(bdat) - bloom.DataHeaderSize
@@ -261,7 +261,7 @@ func parseLayer(layer *layer, algo objectid.Algorithm) error { //nolint:maintidx
}
if cur > bdatDataLenU32 {
- return &ErrMalformed{Path: layer.path, Reason: "BIDX offset out of range"}
+ return &MalformedError{Path: layer.path, Reason: "BIDX offset out of range"}
}
prev = cur
diff --git a/format/commitgraph/read/layer_pos.go b/format/commitgraph/read/layer_pos.go
index b93a842e..7b87b381 100644
--- a/format/commitgraph/read/layer_pos.go
+++ b/format/commitgraph/read/layer_pos.go
@@ -9,12 +9,12 @@ func (reader *Reader) layerByPosition(pos Position) (*layer, error) {
}
if graphIdx < 0 || graphIdx >= len(reader.layers) {
- return nil, &ErrPositionOutOfRange{Pos: pos}
+ return nil, &PositionOutOfRangeError{Pos: pos}
}
layer := &reader.layers[graphIdx]
if pos.Index >= layer.numCommits {
- return nil, &ErrPositionOutOfRange{Pos: pos}
+ return nil, &PositionOutOfRangeError{Pos: pos}
}
return layer, nil
diff --git a/format/commitgraph/read/lookup.go b/format/commitgraph/read/lookup.go
index cfd3b8cc..6ba25a18 100644
--- a/format/commitgraph/read/lookup.go
+++ b/format/commitgraph/read/lookup.go
@@ -8,7 +8,7 @@ import (
// Lookup resolves one object ID to one graph position.
func (reader *Reader) Lookup(oid objectid.ObjectID) (Position, error) {
if oid.Algorithm() != reader.algo {
- return Position{}, &ErrNotFound{OID: oid}
+ return Position{}, &NotFoundError{OID: oid}
}
for layerIdx := len(reader.layers) - 1; layerIdx >= 0; layerIdx-- {
@@ -25,5 +25,5 @@ func (reader *Reader) Lookup(oid objectid.ObjectID) (Position, error) {
}
}
- return Position{}, &ErrNotFound{OID: oid}
+ return Position{}, &NotFoundError{OID: oid}
}
diff --git a/format/commitgraph/read/open_chain.go b/format/commitgraph/read/open_chain.go
index f64040bc..8d5ec268 100644
--- a/format/commitgraph/read/open_chain.go
+++ b/format/commitgraph/read/open_chain.go
@@ -17,7 +17,7 @@ func openChain(root *os.Root, algo objectid.Algorithm) (*Reader, error) {
file, err := root.Open(chainPath)
if err != nil {
if errors.Is(err, os.ErrNotExist) {
- return nil, &ErrMalformed{Path: chainPath, Reason: "missing commit-graph-chain"}
+ return nil, &MalformedError{Path: chainPath, Reason: "missing commit-graph-chain"}
}
return nil, err
@@ -47,7 +47,7 @@ func openChain(root *os.Root, algo objectid.Algorithm) (*Reader, error) {
}
if len(hashes) == 0 {
- return nil, &ErrMalformed{Path: chainPath, Reason: "empty chain"}
+ return nil, &MalformedError{Path: chainPath, Reason: "empty chain"}
}
layers := make([]layer, 0, len(hashes))
@@ -70,7 +70,7 @@ func openChain(root *os.Root, algo objectid.Algorithm) (*Reader, error) {
if len(hashHex) != algo.HexLen() {
closeLayers(layers)
- return nil, &ErrMalformed{
+ return nil, &MalformedError{
Path: chainPath,
Reason: fmt.Sprintf("invalid graph hash length at line %d", i+1),
}
@@ -90,7 +90,7 @@ func openChain(root *os.Root, algo objectid.Algorithm) (*Reader, error) {
closeLayers(layers)
- return nil, &ErrMalformed{
+ return nil, &MalformedError{
Path: relPath,
Reason: fmt.Sprintf("BASE count %d does not match chain depth %d", loaded.baseCount, i),
}
@@ -114,7 +114,7 @@ func openChain(root *os.Root, algo objectid.Algorithm) (*Reader, error) {
closeLayers(layers)
- return nil, &ErrMalformed{Path: relPath, Reason: "total commit count overflow"}
+ return nil, &MalformedError{Path: relPath, Reason: "total commit count overflow"}
}
total = totalNext
diff --git a/format/commitgraph/read/parents.go b/format/commitgraph/read/parents.go
index 0f8024ab..fcaad8b6 100644
--- a/format/commitgraph/read/parents.go
+++ b/format/commitgraph/read/parents.go
@@ -35,7 +35,7 @@ func (reader *Reader) decodeParents(layer *layer, p1, p2 uint32) (ParentRef, Par
}
if len(parents) == 0 {
- return ParentRef{}, ParentRef{}, nil, &ErrMalformed{Path: layer.path, Reason: "empty EDGE list"}
+ return ParentRef{}, ParentRef{}, nil, &MalformedError{Path: layer.path, Reason: "empty EDGE list"}
}
parent2 := ParentRef{Valid: true, Pos: parents[0]}
@@ -52,7 +52,7 @@ func (reader *Reader) decodeSingleParent(raw uint32) (ParentRef, error) {
}
if raw&commitgraph.ParentExtraMask != 0 {
- return ParentRef{}, &ErrMalformed{
+ return ParentRef{}, &MalformedError{
Path: "commit-graph",
Reason: "unexpected EDGE marker in single-parent slot",
}
diff --git a/format/commitgraph/read/position.go b/format/commitgraph/read/position.go
index f92f5b3a..b2e1138b 100644
--- a/format/commitgraph/read/position.go
+++ b/format/commitgraph/read/position.go
@@ -31,7 +31,7 @@ func (reader *Reader) globalToPosition(global uint32) (Position, error) {
}
}
- return Position{}, &ErrMalformed{
+ return Position{}, &MalformedError{
Path: "commit-graph",
Reason: fmt.Sprintf("parent global position out of range: %d", global),
}
diff --git a/format/commitgraph/read/read_test.go b/format/commitgraph/read/read_test.go
index 80091c5b..35384930 100644
--- a/format/commitgraph/read/read_test.go
+++ b/format/commitgraph/read/read_test.go
@@ -157,16 +157,16 @@ func TestBloomUnavailableWithoutChangedPaths(t *testing.T) {
_, err = reader.BloomFilterAt(pos)
if err == nil {
- t.Fatal("BloomFilterAt() error = nil, want ErrBloomUnavailable")
+ t.Fatal("BloomFilterAt() error = nil, want BloomUnavailableError")
}
- var unavailable *read.ErrBloomUnavailable
+ var unavailable *read.BloomUnavailableError
if !errors.As(err, &unavailable) {
- t.Fatalf("BloomFilterAt() error type = %T, want *ErrBloomUnavailable", err)
+ t.Fatalf("BloomFilterAt() error type = %T, want *BloomUnavailableError", err)
}
if unavailable.Pos != pos {
- t.Fatalf("ErrBloomUnavailable.Pos = %+v, want %+v", unavailable.Pos, pos)
+ t.Fatalf("BloomUnavailableError.Pos = %+v, want %+v", unavailable.Pos, pos)
}
})
}