Skip to content

Commit 2d4083f

Browse files
Do not list active repositories as unadopted (#22034) (#22166)
Backport #22034 This fixes a bug where, when searching unadopted repositories, active repositories will be listed as well. This is because the size of the array of repository names to check is larger by one than the `IterateBufferSize`. For an `IterateBufferSize` of 50, the original code will pass 51 repository names but set the query to `LIMIT 50`. If all repositories in the query are active (i.e. not unadopted) one of them will be omitted from the result. Due to the `ORDER BY` clause it will be the oldest (or least recently modified) one. Co-authored-by: Christian Ullrich <[email protected]>
1 parent 56bded9 commit 2d4083f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

services/repository/adopt.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ func ListUnadoptedRepositories(query string, opts *db.ListOptions) ([]string, in
338338
}
339339

340340
repoNamesToCheck = append(repoNamesToCheck, name)
341-
if len(repoNamesToCheck) > setting.Database.IterateBufferSize {
341+
if len(repoNamesToCheck) >= setting.Database.IterateBufferSize {
342342
if err = checkUnadoptedRepositories(userName, repoNamesToCheck, unadopted); err != nil {
343343
return err
344344
}

0 commit comments

Comments
 (0)