sourcebot-dev / sourcebot

Blazingly fast code search 🏎️ Deployed as a single Docker image 📦 Search million+ lines of code in your GitHub, GitLab, and Gitea repositories 🪄 MIT licensed ✅
https://sourcebot.dev
MIT License
1.16k stars 37 forks source link

Multi branch / tag support #58

Closed brendan-kellam closed 2 weeks ago

brendan-kellam commented 2 weeks ago

The following PR adds support for indexing multiple revisions (branches & tags) of a given GitHub, GitLab, or Gitea repository. Configuration of which revisions are included is made via the revisions property:

{
    "$schema": "./schemas/v2/index.json",
    "repos": [
        {
            "type": "github",
            "revisions": {
                 // Specify branches to index...
                "branches": [
                    "main",
                    "release/*"
                ],
                // ... or specify tags
                "tags": [
                    "v*.*.*"
                ]
            },
            "repos": [
                "org/repoa",
                "org/repob"
            ]
        }
   ]
}

The branch / tag values support glob patterns. In this case, we will match against the main branch + all branches starting with release/, as well as all tags that match the semver v*.*.* format. The branches / tags in a given repo (in this case, org/repoa and org/repob) and that match a glob pattern will be included during indexing. The revisions object is similarly supported for GitLab and GItea.

To search a particular revision, the revision: or rev: qualifier can be included in a query. For example:

image

The original zoekt branch: or b: qualifier may also be used.

Fixes #29

msukkari commented 2 weeks ago

nit: scroll bars in repos page seem broken on windows image

msukkari commented 2 weeks ago

what does the "+ 2" here mean? If it's supposed to reference how many branch hits there are, would it be better to instead mention this in the search results at the top (ex. Found X matches in Y files across Z branches)? It's not really intuitive what this number means at first glance image

brendan-kellam commented 2 weeks ago

what does the "+ 2" here mean? If it's supposed to reference how many branch hits there are, would it be better to instead mention this in the search results at the top (ex. Found X matches in Y files across Z branches)? It's not really intuitive what this number means at first glance image

We could surface a "Found X matches in Y files across Z branches" at the top, but we still probably need a per-match UI since different matches may exist in a different number of branches.