ref: 152d7fa7d2fbbfe26170932c58c3d46ad95cf0c1
parent: 738b750f6f527a8e607bc9c016224fcba931f5c1
author: Runxi Yu <me@runxiyu.org>
date: Sun Jan 25 15:42:10 EST 2026
refs: ResolveRefFully should return a Ref rather than a Hash
--- a/refs.go
+++ b/refs.go
@@ -306,34 +306,34 @@
// 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}
}
--
⑨