Skip to content

Commit 84285a1

Browse files
chrullrichzeripathlunny
authored
Do not list active repositories as unadopted (#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. Bug found in 1.17.3. Co-authored-by: zeripath <[email protected]> Co-authored-by: Lunny Xiao <[email protected]>
1 parent 651fe4b commit 84285a1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: services/repository/adopt.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ func ListUnadoptedRepositories(query string, opts *db.ListOptions) ([]string, in
337337
}
338338

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

0 commit comments

Comments
 (0)