diff options
| author | 2026-03-31 03:19:39 +0000 | |
|---|---|---|
| committer | 2026-03-31 03:20:13 +0000 | |
| commit | b82af688be4d94245c4a7eb730b12348b08b414b (patch) | |
| tree | bcd7d9cdb87a5ee2644aafe64429def860f500fe /reachability/walk_expand_commits.go | |
| parent | commitquery: Error handling cleanup after the fetcher port (diff) | |
| signature | No signature | |
reachability: Use fetcher and clean up some legacy helper stuff
Diffstat (limited to 'reachability/walk_expand_commits.go')
| -rw-r--r-- | reachability/walk_expand_commits.go | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/reachability/walk_expand_commits.go b/reachability/walk_expand_commits.go index 8cb93279..eaeb4e72 100644 --- a/reachability/walk_expand_commits.go +++ b/reachability/walk_expand_commits.go @@ -4,8 +4,6 @@ import ( "fmt" "codeberg.org/lindenii/furgit/errors" - objectcommit "codeberg.org/lindenii/furgit/object/commit" - objecttag "codeberg.org/lindenii/furgit/object/tag" objecttype "codeberg.org/lindenii/furgit/object/type" ) @@ -28,41 +26,31 @@ func (walk *Walk) expandCommits(item walkItem) ([]walkItem, error) { } } - ty, err := walk.readHeaderType(item.id) + ty, _, err := walk.reachability.fetcher.Header(item.id) if err != nil { return nil, err } switch ty { case objecttype.TypeCommit: - content, err := walk.readBytesContent(item.id) + commit, err := walk.reachability.fetcher.ExactCommit(item.id) if err != nil { return nil, err } - commit, err := objectcommit.Parse(content, item.id.Algorithm()) - if err != nil { - return nil, err - } - - next := make([]walkItem, 0, len(commit.Parents)) - for _, parent := range commit.Parents { + next := make([]walkItem, 0, len(commit.Object().Parents)) + for _, parent := range commit.Object().Parents { next = append(next, walkItem{id: parent, want: objecttype.TypeInvalid}) } return next, nil case objecttype.TypeTag: - content, err := walk.readBytesContent(item.id) - if err != nil { - return nil, err - } - - tag, err := objecttag.Parse(content, item.id.Algorithm()) + tag, err := walk.reachability.fetcher.ExactTag(item.id) if err != nil { return nil, err } - return []walkItem{{id: tag.Target, want: objecttype.TypeInvalid}}, nil + return []walkItem{{id: tag.Object().Target, want: objecttype.TypeInvalid}}, nil case objecttype.TypeTree, objecttype.TypeBlob, objecttype.TypeInvalid, objecttype.TypeFuture, objecttype.TypeOfsDelta, objecttype.TypeRefDelta: return nil, &errors.ObjectTypeError{OID: item.id, Got: ty, Want: objecttype.TypeCommit} |
