summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew McCallum <andrew.mccallum@semafone.com>2018-01-15 10:05:46 +0000
committerAndrew McCallum <andrew.mccallum@semafone.com>2018-01-15 10:12:19 +0000
commite5afb44a9a1ef1f613f11e6bbb4134f30aaae655 (patch)
tree9cf4a884b6301f7539116090f7d467c00df3b612
parentf402762d2c315f462fb3c805990b9842953bc8dc (diff)
downloadgitlab-ce-e5afb44a9a1ef1f613f11e6bbb4134f30aaae655.tar.gz
Strip off leading slashes when searching in context of repository.
-rw-r--r--app/models/repository.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 2ffd9558ebc..ab46872393b 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -940,7 +940,7 @@ class Repository
def search_files_by_name(query, ref)
return [] if empty? || query.blank?
- args = %W(ls-tree --full-tree -r #{ref || root_ref} --name-status | #{Regexp.escape(query)})
+ args = %W(ls-tree --full-tree -r #{ref || root_ref} --name-status | #{Regexp.escape(query.sub(/^\/*/,""))})
run_git(args).first.lines.map(&:strip)
end