Skip to content

Commit

Permalink
sourcegraph: backend: unexport Repo.Add (#47519)
Browse files Browse the repository at this point in the history
Commit: 4a8734ba22d08755c903a3270898f215b9a780a4
  • Loading branch information
Keegan Carruthers-Smith authored and sourcegraph-bot committed Feb 12, 2023
1 parent f424b7a commit 9238db8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 129 deletions.
123 changes: 0 additions & 123 deletions sourcegraph/cmd/frontend/backend/mocks_temp.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions sourcegraph/cmd/frontend/backend/repos.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import (
type ReposService interface {
Get(ctx context.Context, repo api.RepoID) (*types.Repo, error)
GetByName(ctx context.Context, name api.RepoName) (*types.Repo, error)
Add(ctx context.Context, name api.RepoName) (api.RepoName, error)
List(ctx context.Context, opt database.ReposListOptions) ([]*types.Repo, error)
ListIndexable(ctx context.Context) ([]types.MinimalRepo, error)
GetInventory(ctx context.Context, repo *types.Repo, commitID api.CommitID, forceEnhancedLanguageDetection bool) (*inventory.Inventory, error)
Expand Down Expand Up @@ -105,7 +104,7 @@ func (s *repos) GetByName(ctx context.Context, name api.RepoName) (_ *types.Repo
return nil, err
}

newName, err := s.Add(ctx, name)
newName, err := s.add(ctx, name)
if err == nil {
return s.store.GetByName(ctx, newName)
}
Expand All @@ -132,10 +131,10 @@ var metricIsRepoCloneable = promauto.NewCounterVec(prometheus.CounterOpts{
Help: "temporary metric to measure if this codepath is valuable on sourcegraph.com",
}, []string{"status"})

// Add adds the repository with the given name to the database by calling
// add adds the repository with the given name to the database by calling
// repo-updater when in sourcegraph.com mode. It's possible that the repo has
// been renamed on the code host in which case a different name may be returned.
func (s *repos) Add(ctx context.Context, name api.RepoName) (addedName api.RepoName, err error) {
func (s *repos) add(ctx context.Context, name api.RepoName) (addedName api.RepoName, err error) {
ctx, done := trace(ctx, "Repos", "Add", name, &err)
defer done()

Expand Down
4 changes: 2 additions & 2 deletions sourcegraph/cmd/frontend/backend/repos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func TestRepos_Add(t *testing.T) {
logger: logtest.Scoped(t),
gitserverClient: gsClient,
}
addedName, err := s.Add(ctx, repoName)
addedName, err := s.add(ctx, repoName)
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -127,7 +127,7 @@ func TestRepos_Add_NonPublicCodehosts(t *testing.T) {
defer func() { gitserver.MockIsRepoCloneable = nil }()

// The repoName could change if it has been renamed on the code host
_, err := s.Add(ctx, repoName)
_, err := s.add(ctx, repoName)
if !errcode.IsNotFound(err) {
t.Fatalf("expected a not found error, got: %v", err)
}
Expand Down

0 comments on commit 9238db8

Please sign in to comment.