aboutsummaryrefslogtreecommitdiff
path: root/reachability
diff options
context:
space:
mode:
Diffstat (limited to 'reachability')
-rw-r--r--reachability/ancestor.go4
-rw-r--r--reachability/errors.go12
-rw-r--r--reachability/helpers.go4
-rw-r--r--reachability/integration_test.go4
-rw-r--r--reachability/peel.go2
-rw-r--r--reachability/unit_test.go12
-rw-r--r--reachability/walk_expand_commits.go2
-rw-r--r--reachability/walk_expand_commits_graph.go2
-rw-r--r--reachability/walk_expand_objects.go4
-rw-r--r--reachability/walk_verify.go2
10 files changed, 24 insertions, 24 deletions
diff --git a/reachability/ancestor.go b/reachability/ancestor.go
index 98a2c080..211aed01 100644
--- a/reachability/ancestor.go
+++ b/reachability/ancestor.go
@@ -57,7 +57,7 @@ func (r *Reachability) isAncestorGraph(ancestor, descendant objectid.ObjectID) (
ancestorPos, err := r.graph.Lookup(ancestor)
if err != nil {
- var notFound *commitgraphread.ErrNotFound
+ var notFound *commitgraphread.NotFoundError
if errors.As(err, &notFound) {
return false, false, nil
}
@@ -67,7 +67,7 @@ func (r *Reachability) isAncestorGraph(ancestor, descendant objectid.ObjectID) (
descendantPos, err := r.graph.Lookup(descendant)
if err != nil {
- var notFound *commitgraphread.ErrNotFound
+ var notFound *commitgraphread.NotFoundError
if errors.As(err, &notFound) {
return false, false, nil
}
diff --git a/reachability/errors.go b/reachability/errors.go
index 7d0d9a18..0f0c6047 100644
--- a/reachability/errors.go
+++ b/reachability/errors.go
@@ -7,24 +7,24 @@ import (
"codeberg.org/lindenii/furgit/objecttype"
)
-// ErrObjectMissing indicates that a referenced object is absent from the store.
-type ErrObjectMissing struct {
+// ObjectMissingError indicates that a referenced object is absent from the store.
+type ObjectMissingError struct {
OID objectid.ObjectID
}
-func (e *ErrObjectMissing) Error() string {
+func (e *ObjectMissingError) Error() string {
return fmt.Sprintf("reachability: missing object %s", e.OID)
}
-// ErrObjectType indicates that a referenced object has a different type than
+// ObjectTypeError indicates that a referenced object has a different type than
// what traversal expected on that edge.
-type ErrObjectType struct {
+type ObjectTypeError struct {
OID objectid.ObjectID
Got objecttype.Type
Want objecttype.Type
}
-func (e *ErrObjectType) Error() string {
+func (e *ObjectTypeError) Error() string {
gotName, gotOK := objecttype.Name(e.Got)
if !gotOK {
gotName = fmt.Sprintf("type(%d)", e.Got)
diff --git a/reachability/helpers.go b/reachability/helpers.go
index 41a2f80b..9fdc99d8 100644
--- a/reachability/helpers.go
+++ b/reachability/helpers.go
@@ -39,7 +39,7 @@ func (r *Reachability) readHeaderType(id objectid.ObjectID) (objecttype.Type, er
ty, _, err := r.store.ReadHeader(id)
if err != nil {
if errors.Is(err, objectstore.ErrObjectNotFound) {
- return objecttype.TypeInvalid, &ErrObjectMissing{OID: id}
+ return objecttype.TypeInvalid, &ObjectMissingError{OID: id}
}
return objecttype.TypeInvalid, err
@@ -61,7 +61,7 @@ func (r *Reachability) readBytesContent(id objectid.ObjectID) ([]byte, error) {
_, content, err := r.store.ReadBytesContent(id)
if err != nil {
if errors.Is(err, objectstore.ErrObjectNotFound) {
- return nil, &ErrObjectMissing{OID: id}
+ return nil, &ObjectMissingError{OID: id}
}
return nil, err
diff --git a/reachability/integration_test.go b/reachability/integration_test.go
index 079ce5fc..c7c5c63d 100644
--- a/reachability/integration_test.go
+++ b/reachability/integration_test.go
@@ -236,9 +236,9 @@ func TestCheckConnectedMissingObject(t *testing.T) {
t.Fatal("expected error")
}
- var missing *reachability.ErrObjectMissing
+ var missing *reachability.ObjectMissingError
if !errors.As(err, &missing) {
- t.Fatalf("expected ErrObjectMissing, got %T (%v)", err, err)
+ t.Fatalf("expected ObjectMissingError, got %T (%v)", err, err)
}
if missing.OID != treeID {
diff --git a/reachability/peel.go b/reachability/peel.go
index 7b9e7bf1..e8120ef7 100644
--- a/reachability/peel.go
+++ b/reachability/peel.go
@@ -20,7 +20,7 @@ func (r *Reachability) peelRootToDomain(id objectid.ObjectID, domain Domain) (ob
if ty != objecttype.TypeTag {
if domain == DomainCommits && ty != objecttype.TypeCommit {
- return objectid.ObjectID{}, &ErrObjectType{OID: id, Got: ty, Want: objecttype.TypeCommit}
+ return objectid.ObjectID{}, &ObjectTypeError{OID: id, Got: ty, Want: objecttype.TypeCommit}
}
return id, nil
diff --git a/reachability/unit_test.go b/reachability/unit_test.go
index 8f19cfcd..2fef2b48 100644
--- a/reachability/unit_test.go
+++ b/reachability/unit_test.go
@@ -233,9 +233,9 @@ func TestWalkDomainCommitsRejectsNonCommitRootAfterPeel(t *testing.T) {
t.Fatal("expected error")
}
- var typeErr *reachability.ErrObjectType
+ var typeErr *reachability.ObjectTypeError
if !errors.As(err, &typeErr) {
- t.Fatalf("expected ErrObjectType, got %T (%v)", err, err)
+ t.Fatalf("expected ObjectTypeError, got %T (%v)", err, err)
}
if typeErr.Got != objecttype.TypeTree || typeErr.Want != objecttype.TypeCommit {
@@ -349,9 +349,9 @@ func TestCheckConnectedReturnsConcreteMissingObject(t *testing.T) {
t.Fatal("expected error")
}
- var missing *reachability.ErrObjectMissing
+ var missing *reachability.ObjectMissingError
if !errors.As(err, &missing) {
- t.Fatalf("expected ErrObjectMissing, got %T (%v)", err, err)
+ t.Fatalf("expected ObjectMissingError, got %T (%v)", err, err)
}
if missing.OID != missingParent {
@@ -441,9 +441,9 @@ func TestIsAncestorRejectsNonCommitAfterPeel(t *testing.T) {
t.Fatal("expected error")
}
- var typeErr *reachability.ErrObjectType
+ var typeErr *reachability.ObjectTypeError
if !errors.As(err, &typeErr) {
- t.Fatalf("expected ErrObjectType, got %T (%v)", err, err)
+ t.Fatalf("expected ObjectTypeError, got %T (%v)", err, err)
}
})
}
diff --git a/reachability/walk_expand_commits.go b/reachability/walk_expand_commits.go
index 11c5c692..e72092f4 100644
--- a/reachability/walk_expand_commits.go
+++ b/reachability/walk_expand_commits.go
@@ -63,7 +63,7 @@ func (walk *Walk) expandCommits(item walkItem) ([]walkItem, error) {
return []walkItem{{id: tag.Target, want: objecttype.TypeInvalid}}, nil
case objecttype.TypeTree, objecttype.TypeBlob, objecttype.TypeInvalid,
objecttype.TypeFuture, objecttype.TypeOfsDelta, objecttype.TypeRefDelta:
- return nil, &ErrObjectType{OID: item.id, Got: ty, Want: objecttype.TypeCommit}
+ return nil, &ObjectTypeError{OID: item.id, Got: ty, Want: objecttype.TypeCommit}
}
return nil, fmt.Errorf("reachability: unreachable object type %d", ty)
diff --git a/reachability/walk_expand_commits_graph.go b/reachability/walk_expand_commits_graph.go
index bbdc0ade..90e52112 100644
--- a/reachability/walk_expand_commits_graph.go
+++ b/reachability/walk_expand_commits_graph.go
@@ -11,7 +11,7 @@ import (
func (walk *Walk) expandCommitsFromGraph(id objectid.ObjectID) ([]walkItem, bool, error) {
pos, err := walk.reachability.graph.Lookup(id)
if err != nil {
- var notFound *commitgraphread.ErrNotFound
+ var notFound *commitgraphread.NotFoundError
if errors.As(err, &notFound) {
return nil, false, nil
}
diff --git a/reachability/walk_expand_objects.go b/reachability/walk_expand_objects.go
index 97cab79c..9dc2ff80 100644
--- a/reachability/walk_expand_objects.go
+++ b/reachability/walk_expand_objects.go
@@ -14,7 +14,7 @@ func (walk *Walk) expandObjects(item walkItem) ([]walkItem, error) {
}
if item.want != objecttype.TypeInvalid && ty != item.want {
- return nil, &ErrObjectType{OID: item.id, Got: ty, Want: item.want}
+ return nil, &ObjectTypeError{OID: item.id, Got: ty, Want: item.want}
}
switch ty {
@@ -76,7 +76,7 @@ func (walk *Walk) expandObjects(item walkItem) ([]walkItem, error) {
return []walkItem{{id: tag.Target, want: tag.TargetType}}, nil
case objecttype.TypeInvalid, objecttype.TypeFuture, objecttype.TypeOfsDelta, objecttype.TypeRefDelta:
- return nil, &ErrObjectType{OID: item.id, Got: ty, Want: item.want}
+ return nil, &ObjectTypeError{OID: item.id, Got: ty, Want: item.want}
}
return nil, fmt.Errorf("reachability: unreachable object type %d", ty)
diff --git a/reachability/walk_verify.go b/reachability/walk_verify.go
index 46798f5a..82eb7566 100644
--- a/reachability/walk_verify.go
+++ b/reachability/walk_verify.go
@@ -13,7 +13,7 @@ func (walk *Walk) validateCommitObject(id objectid.ObjectID) error {
}
if ty != objecttype.TypeCommit {
- return &ErrObjectType{OID: id, Got: ty, Want: objecttype.TypeCommit}
+ return &ObjectTypeError{OID: id, Got: ty, Want: objecttype.TypeCommit}
}
content, err := walk.readBytesContent(id)