aboutsummaryrefslogtreecommitdiff
path: root/commitquery/query_load_by_oid.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-31 03:17:56 +0000
committerGravatar Runxi Yu2026-03-31 03:17:56 +0000
commit3ce59c3248dec0eb0f918c42f37f53bc2ac20425 (patch)
tree183eaec2d26b037324f41ff7f79dda67396b400e /commitquery/query_load_by_oid.go
parentobject/fetch: Wrap ReadSize errors (diff)
signatureNo signature
commitquery: Error handling cleanup after the fetcher port
Still a few weird parts, but I forgot what those helpers were for, and the semantics were a bit awkward... will check laterâ„¢
Diffstat (limited to 'commitquery/query_load_by_oid.go')
-rw-r--r--commitquery/query_load_by_oid.go29
1 files changed, 6 insertions, 23 deletions
diff --git a/commitquery/query_load_by_oid.go b/commitquery/query_load_by_oid.go
index b9860a05..f9c956ee 100644
--- a/commitquery/query_load_by_oid.go
+++ b/commitquery/query_load_by_oid.go
@@ -3,11 +3,7 @@ package commitquery
import (
stderrors "errors"
- giterrors "codeberg.org/lindenii/furgit/errors"
commitgraphread "codeberg.org/lindenii/furgit/format/commitgraph/read"
- "codeberg.org/lindenii/furgit/object/commit"
- objectstore "codeberg.org/lindenii/furgit/object/store"
- objecttype "codeberg.org/lindenii/furgit/object/type"
)
// loadByOID populates one node from an object ID.
@@ -25,34 +21,21 @@ func (query *query) loadByOID(idx nodeIndex) error {
}
}
- obj, err := query.fetcher.ExactObject(id)
+ commit, err := query.fetcher.ExactCommit(id)
if err != nil {
- if stderrors.Is(err, objectstore.ErrObjectNotFound) {
- return &giterrors.ObjectMissingError{OID: id}
- }
-
return err
}
- commitObj, ok := obj.Object().(*commit.Commit)
- if !ok {
- return &giterrors.ObjectTypeError{
- OID: id,
- Got: obj.Object().ObjectType(),
- Want: objecttype.TypeCommit,
- }
- }
-
- parents := make([]parentRef, 0, len(commitObj.Parents))
- for _, parentID := range commitObj.Parents {
+ parents := make([]parentRef, 0, len(commit.Object().Parents))
+ for _, parentID := range commit.Object().Parents {
parents = append(parents, parentRef{ID: parentID})
}
- commit := commitData{
+ commitData := commitData{
ID: id,
Parents: parents,
- CommitTime: commitObj.Committer.WhenUnix,
+ CommitTime: commit.Object().Committer.WhenUnix,
}
- return query.populateNode(idx, commit)
+ return query.populateNode(idx, commitData)
}