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/models/repository.rb')
-rw-r--r--app/models/repository.rb26
1 files changed, 14 insertions, 12 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index b2efc9b480b..7dca8e52403 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -995,7 +995,13 @@ class Repository
def search_files_by_wildcard_path(path, ref = 'HEAD')
# We need to use RE2 to match Gitaly's regexp engine
- regexp_string = RE2::Regexp.escape(path).gsub('\*', '.*?')
+ regexp_string = RE2::Regexp.escape(path)
+
+ anything = '.*?'
+ anything_but_not_slash = '([^\/])*?'
+ regexp_string.gsub!('\*\*', anything)
+ regexp_string.gsub!('\*', anything_but_not_slash)
+
raw_repository.search_files_by_regexp("^#{regexp_string}$", ref)
end
@@ -1165,17 +1171,13 @@ class Repository
end
def tags_sorted_by_committed_date
- tags.sort_by do |tag|
- # Annotated tags can point to any object (e.g. a blob), but generally
- # tags point to a commit. If we don't have a commit, then just default
- # to putting the tag at the end of the list.
- target = tag.dereferenced_target
+ # Annotated tags can point to any object (e.g. a blob), but generally
+ # tags point to a commit. If we don't have a commit, then just default
+ # to putting the tag at the end of the list.
+ default = Time.current
- if target
- target.committed_date
- else
- Time.current
- end
+ tags.sort_by do |tag|
+ tag.dereferenced_target&.committed_date || default
end
end
@@ -1191,4 +1193,4 @@ class Repository
end
end
-Repository.prepend_if_ee('EE::Repository')
+Repository.prepend_mod_with('Repository')