From bd63f30f9f29793ed00bdc38ec47f848d5394098 Mon Sep 17 00:00:00 2001 From: nadavsteindler Date: Tue, 17 Dec 2024 13:33:17 +0200 Subject: [PATCH] clean code --- pkg/catalog/catalog.go | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/pkg/catalog/catalog.go b/pkg/catalog/catalog.go index af7193e85e3..a2439956694 100644 --- a/pkg/catalog/catalog.go +++ b/pkg/catalog/catalog.go @@ -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 {