diff options
| author | 2025-11-25 08:00:00 +0800 | |
|---|---|---|
| committer | 2025-11-25 08:00:00 +0800 | |
| commit | 113317d91202f50d24f96a30b2f0df758eb5f2b0 (patch) | |
| tree | 631f89d95d91854587d12571ecfafec50c7e326c /refs.go | |
| parent | refs: Add ShowRefs (diff) | |
| signature | No signature | |
refs: Rename ShowRefs -> ListRefs
Diffstat (limited to 'refs.go')
| -rw-r--r-- | refs.go | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -144,8 +144,8 @@ type Ref struct { Peeled Hash } -// ShowRef represents a reference entry as returned by ShowRefs. -type ShowRef struct { +// ListRef represents a reference entry as returned by ListRefs. +type ListRef struct { // Name is the fully qualified ref name (e.g., refs/heads/main). Name string // Ref describes the reference target. @@ -235,7 +235,7 @@ func (repo *Repository) resolveRefFully(path string, seen map[string]struct{}) ( } } -// ShowRefs lists refs similarly to git-show-ref. +// ListRefs lists refs similarly to git-show-ref. // // The pattern must be empty or begin with "refs/". An empty pattern is // treated as "refs/*". @@ -244,7 +244,7 @@ func (repo *Repository) resolveRefFully(path string, seen map[string]struct{}) ( // repository root, then packed refs are read while skipping any names // that already appeared as loose refs. Packed refs are filtered // similarly. -func (repo *Repository) ShowRefs(pattern string) ([]ShowRef, error) { +func (repo *Repository) ListRefs(pattern string) ([]ListRef, error) { if pattern == "" { pattern = "refs/*" } @@ -255,7 +255,7 @@ func (repo *Repository) ShowRefs(pattern string) ([]ShowRef, error) { return nil, ErrInvalidRef } - var out []ShowRef + var out []ListRef seen := make(map[string]struct{}) globPattern := filepath.Join(repo.rootPath, filepath.FromSlash(pattern)) @@ -290,7 +290,7 @@ func (repo *Repository) ShowRefs(pattern string) ([]ShowRef, error) { } seen[name] = struct{}{} - out = append(out, ShowRef{ + out = append(out, ListRef{ Name: name, Ref: ref, }) @@ -357,7 +357,7 @@ func (repo *Repository) ShowRefs(pattern string) ([]ShowRef, error) { if parseErr != nil { return nil, parseErr } - out = append(out, ShowRef{ + out = append(out, ListRef{ Name: name, Ref: Ref{ Kind: RefKindDetached, |
