cache: consistently use "ref" to fetch a repository

This commit is contained in:
Michael Muré 2019-06-23 21:28:01 +02:00
parent bc03a89aa7
commit 9f4da4ce4f
No known key found for this signature in database
GPG Key ID: A4457C029293126F
3 changed files with 6 additions and 6 deletions

View File

@ -54,7 +54,7 @@ func (c *MultiRepoCache) DefaultRepo() (*RepoCache, error) {
panic("unreachable")
}
// ResolveRepo retrieve a repository by name
// ResolveRepo retrieve a repository with a reference
func (c *MultiRepoCache) ResolveRepo(ref string) (*RepoCache, error) {
r, ok := c.repos[ref]
if !ok {

View File

@ -15,9 +15,9 @@ type mutationResolver struct {
cache *cache.MultiRepoCache
}
func (r mutationResolver) getRepo(repoRef *string) (*cache.RepoCache, error) {
if repoRef != nil {
return r.cache.ResolveRepo(*repoRef)
func (r mutationResolver) getRepo(ref *string) (*cache.RepoCache, error) {
if ref != nil {
return r.cache.ResolveRepo(*ref)
}
return r.cache.DefaultRepo()

View File

@ -27,8 +27,8 @@ func (r rootQueryResolver) DefaultRepository(ctx context.Context) (*models.Repos
}, nil
}
func (r rootQueryResolver) Repository(ctx context.Context, id string) (*models.Repository, error) {
repo, err := r.cache.ResolveRepo(id)
func (r rootQueryResolver) Repository(ctx context.Context, ref string) (*models.Repository, error) {
repo, err := r.cache.ResolveRepo(ref)
if err != nil {
return nil, err