From 152d7fa7d2fbbfe26170932c58c3d46ad95cf0c1 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sun, 25 Jan 2026 20:42:10 +0100 Subject: refs: ResolveRefFully should return a Ref rather than a Hash --- refs.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/refs.go b/refs.go index 1e185e52..372d31fd 100644 --- a/refs.go +++ b/refs.go @@ -306,34 +306,34 @@ func (repo *Repository) ResolveRef(path string) (Ref, error) { // symbolic references until it reaches a detached ref. // Symbolic cycles are detected and reported. // Annotated tags are not peeled. -func (repo *Repository) ResolveRefFully(path string) (Hash, error) { +func (repo *Repository) ResolveRefFully(path string) (Ref, error) { seen := make(map[string]struct{}) return repo.resolveRefFully(path, seen) } -func (repo *Repository) resolveRefFully(path string, seen map[string]struct{}) (Hash, error) { +func (repo *Repository) resolveRefFully(path string, seen map[string]struct{}) (Ref, error) { if _, found := seen[path]; found { - return Hash{}, fmt.Errorf("symbolic ref cycle involving %q", path) + return Ref{}, fmt.Errorf("symbolic ref cycle involving %q", path) } seen[path] = struct{}{} ref, err := repo.ResolveRef(path) if err != nil { - return Hash{}, err + return Ref{}, err } switch ref.Kind { case RefKindDetached: - return ref.Hash, nil + return ref, nil case RefKindSymbolic: if ref.Ref == "" { - return Hash{}, ErrInvalidRef + return Ref{}, ErrInvalidRef } return repo.resolveRefFully(ref.Ref, seen) default: - return Hash{}, ErrInvalidRef + return Ref{}, ErrInvalidRef } } -- cgit v1.3.1-10-gc9f91