diff options
| author | 2026-01-25 20:42:10 +0100 | |
|---|---|---|
| committer | 2026-01-25 20:42:10 +0100 | |
| commit | 152d7fa7d2fbbfe26170932c58c3d46ad95cf0c1 (patch) | |
| tree | 7c37bbb3a6edbb7cbf18840cf21c39bbcb3ffbfc | |
| parent | .editorconfig (diff) | |
| signature | No signature | |
refs: ResolveRefFully should return a Ref rather than a Hash v0.1.0
| -rw-r--r-- | refs.go | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -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 } } |
