Search for code lines including brackets + search on different branches #274
-
Dear Sourcebot Team, thank you for this great tool. I am currently evaluating it for a self-hosted Gitlab environment and it works well. I run the docker container in WSL and needed to apply this workaround here to get it running: #263 (comment) May I ask two questions:
Thanks in Advance, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
thanks for using the tool! Answering your questions:
|
Beta Was this translation helpful? Give feedback.
-
Hi Brendan, thank you for your response and sorry for my late answer. Searching including brackets now works well. Our use case (for search in multiple branches) is the following: We have some repos where one repo hosts e.g. 2 or 3 different applications/projects. It might be that one application lives in repo A on branch X, and another application in the same repo A on branch Y. The default branch of that repo is e.g. branch X -> so by default we would not find code in branch Y. Our main use case for sourcebot is to search for files and faulty code in all repos. E.g. if I find a problem with some code lines in a project A I want to see which other projects have the same faulty code lines (and need to be fixed as well). |
Beta Was this translation helpful? Give feedback.
thanks for using the tool!
Answering your questions:
The TLDR answer is that you can use
\
to escape brackets. For example,foo\(bar\);
. If your search includes spaces, you should use wrap the expression in""
and use\\
(since\
now needs to be escaped). E.g.,"myFunction\\(argument1, argument2\\);"
. Checkout this doc for a quick reference.The more in-depth answer is that queries consist of space separated regular expressions that are AND'd together on a per-file basis (e.g.,
foo bar
means that the regex/foo/
and the regex/bar/
must both match in a given file for that file to be included in the search results). Theor
keyword allows you to change this behaviour s.t., regexs are OR'd…