Allow search of code with hyphen
Sorry to disturb
I find there will be 500 error if search key is begin with dash/hyphen. ( Search "--abc" or "- abc")
I read app/models/repository.rb
def search_files(query, ref)
offset = 2
args = %W(git grep -i -n --before-context #{offset} --after-context #{offset} #{query} #{ref || root_ref})
Gitlab::Popen.popen(args, path_to_repo).first.scrub.split(/^--$/)
end
The #{query} can't begin with dash/hyphen.
And I learn from google that, if we put "--" before #{query}, it signify the end of the options, and fix our 500 error.
Can we fix the 500 error in this way? Or maybe you will fix it in some better way.
Thank you : )