diff options
| author | 2026-03-25 19:33:32 +0000 | |
|---|---|---|
| committer | 2026-03-25 19:33:57 +0000 | |
| commit | 1aa5cad4c8d6455eeb1f10893549e18bcca11996 (patch) | |
| tree | 31082a30bde08639fc764c52c3cf2283489f3302 /object/fetch/exact_commit.go | |
| parent | TODO: updates (diff) | |
| signature | No signature | |
object/fetch: Rename from object/resolve
Diffstat (limited to 'object/fetch/exact_commit.go')
| -rw-r--r-- | object/fetch/exact_commit.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/object/fetch/exact_commit.go b/object/fetch/exact_commit.go new file mode 100644 index 00000000..d3f9dee1 --- /dev/null +++ b/object/fetch/exact_commit.go @@ -0,0 +1,24 @@ +package fetch + +import ( + "fmt" + + "codeberg.org/lindenii/furgit/object/commit" + objectid "codeberg.org/lindenii/furgit/object/id" + "codeberg.org/lindenii/furgit/object/stored" +) + +// ExactCommit reads, parses, and wraps the commit at id. +func (r *Fetcher) ExactCommit(id objectid.ObjectID) (*stored.Stored[*commit.Commit], error) { + parsed, err := r.parseObject(id) + if err != nil { + return nil, err + } + + commit, ok := parsed.(*commit.Commit) + if !ok { + return nil, fmt.Errorf("object/fetch: expected commit object %s, got %v", id, parsed.ObjectType()) + } + + return stored.New(id, commit), nil +} |
