Skip to content

Commit

Permalink
clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
nadavsteindler committed Dec 17, 2024
1 parent 8fbb77f commit bd63f30
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions pkg/catalog/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -614,22 +614,22 @@ func (c *Catalog) ListRepositories(ctx context.Context, limit int, prefix, searc
if !strings.HasPrefix(string(record.RepositoryID), prefix) {
break
}

if strings.Contains(string(record.RepositoryID), searchString) {
if record.RepositoryID == afterRepositoryID {
continue
}
repos = append(repos, &Repository{
Name: record.RepositoryID.String(),
StorageNamespace: record.StorageNamespace.String(),
DefaultBranch: record.DefaultBranchID.String(),
CreationDate: record.CreationDate,
ReadOnly: record.ReadOnly,
})
// collect limit +1 to return limit and has more
if len(repos) >= limit+1 {
break
}
if !strings.Contains(string(record.RepositoryID), searchString) {
continue
}
if record.RepositoryID == afterRepositoryID {
continue
}
repos = append(repos, &Repository{
Name: record.RepositoryID.String(),
StorageNamespace: record.StorageNamespace.String(),
DefaultBranch: record.DefaultBranchID.String(),
CreationDate: record.CreationDate,
ReadOnly: record.ReadOnly,
})
// collect limit +1 to return limit and has more
if len(repos) >= limit+1 {
break
}
}
if err := it.Err(); err != nil {
Expand Down

0 comments on commit bd63f30

Please sign in to comment.