From 496e07c1c94cbb2334028191a8984c2314bbc47f Mon Sep 17 00:00:00 2001 From: Pablo Saavedra Date: Mon, 27 Mar 2017 05:23:17 +0200 Subject: [PATCH] models/repo: avoid duplicated results in SearchRepositoryByName (#4344) --- models/repo.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/repo.go b/models/repo.go index d19010a18..a597f82ed 100644 --- a/models/repo.go +++ b/models/repo.go @@ -1654,7 +1654,7 @@ func SearchRepositoryByName(opts *SearchRepoOptions) (repos []*Repository, _ int if len(opts.OrderBy) > 0 { sess.OrderBy("repo." + opts.OrderBy) } - return repos, count, sess.Limit(opts.PageSize, (opts.Page-1)*opts.PageSize).Find(&repos) + return repos, count, sess.Distinct("repo.*").Limit(opts.PageSize, (opts.Page-1)*opts.PageSize).Find(&repos) } func DeleteOldRepositoryArchives() {