Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/finders/packages/maven/package_finder.rb')
-rw-r--r--app/finders/packages/maven/package_finder.rb16
1 files changed, 11 insertions, 5 deletions
diff --git a/app/finders/packages/maven/package_finder.rb b/app/finders/packages/maven/package_finder.rb
index 775db12adb7..7e753705cbd 100644
--- a/app/finders/packages/maven/package_finder.rb
+++ b/app/finders/packages/maven/package_finder.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Packages
module Maven
class PackageFinder
@@ -27,17 +28,22 @@ module Packages
elsif group
packages_for_multiple_projects
else
- packages
+ ::Packages::Package.none
end
end
def packages_with_path
- base.only_maven_packages_with_path(path)
+ matching_packages = base.only_maven_packages_with_path(path)
+ matching_packages = matching_packages.order_by_package_file if versionless_package?(matching_packages)
+
+ matching_packages
end
- # Produces a query that returns all packages.
- def packages
- ::Packages::Package.all
+ def versionless_package?(matching_packages)
+ return if matching_packages.empty?
+
+ # if one matching package is versionless, they all are.
+ matching_packages.first&.version.nil?
end
# Produces a query that retrieves packages from a single project.