diff options
author | Michael Muré <batolettre@gmail.com> | 2019-06-23 21:28:01 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2019-06-23 21:28:01 +0200 |
commit | 9f4da4ce4fbbf23798b80289af170c9c42ac73eb (patch) | |
tree | 6cf71b3c05b0cd2e4d93111cfa45c9c08762d1f0 | |
parent | bc03a89aa76cad37daf8cd4efdea463a9569c519 (diff) | |
download | git-bug-9f4da4ce4fbbf23798b80289af170c9c42ac73eb.tar.gz |
cache: consistently use "ref" to fetch a repository
-rw-r--r-- | cache/multi_repo_cache.go | 2 | ||||
-rw-r--r-- | graphql/resolvers/mutation.go | 6 | ||||
-rw-r--r-- | graphql/resolvers/query.go | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/cache/multi_repo_cache.go b/cache/multi_repo_cache.go index fa5a2041..a55bbcce 100644 --- a/cache/multi_repo_cache.go +++ b/cache/multi_repo_cache.go @@ -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 { diff --git a/graphql/resolvers/mutation.go b/graphql/resolvers/mutation.go index 9ed4e780..b4f8845a 100644 --- a/graphql/resolvers/mutation.go +++ b/graphql/resolvers/mutation.go @@ -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() diff --git a/graphql/resolvers/query.go b/graphql/resolvers/query.go index 80b5a896..aa4e1d85 100644 --- a/graphql/resolvers/query.go +++ b/graphql/resolvers/query.go @@ -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 |