mirror of
https://github.com/MichaelMure/git-bug.git
synced 2024-12-14 17:51:44 +03:00
cache: consistently use "ref" to fetch a repository
This commit is contained in:
parent
bc03a89aa7
commit
9f4da4ce4f
2
cache/multi_repo_cache.go
vendored
2
cache/multi_repo_cache.go
vendored
@ -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 {
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user