phillipj / gitlab-search

Command line tool to search for contents in GitLab repositories
MIT License
304 stars 37 forks source link

Is it possible to search all branches? #23

Closed graham73may closed 3 years ago

graham73may commented 3 years ago

This might be a question about what's possible with Gitlab's API or it might be a feature request, I'm not sure...

Is it possible to search all branches? I think currently the results are only based on the master branch?

phillipj commented 3 years ago

Myeah, I also feel this is mostly a GitLab API question.

The docs says it's possible to choose branch/tag via the ref parameter. When not provided, the repo/project' default branch is chosen: GitLab Search API/Projects.

There's ofcourse a creative way around this, where one could loop through all branches of any given repository and one search per branch, not just one per repository as today. Having in mind it's natural for git repositories to have many branches, I'd be reluctant introducing such a trick in gitlab-search, as that would most likely make a big difference for many users.

systemsgo commented 1 year ago

Is there a way to select the branch to search? Ideally I'd like to be able to pass a comma separated list of branches and have gitlab-search include all of them in the search results.

phillipj commented 1 year ago

@systemsgo rephrasing my answer from earlier; yes, the GitLab API supports specifying the branch to search within. The gitlab-search tool does not have support for that as of now.