Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: Support indexing of local directories #19

Open
BojanKV opened this issue Oct 2, 2024 · 2 comments
Open

FR: Support indexing of local directories #19

BojanKV opened this issue Oct 2, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@BojanKV
Copy link

BojanKV commented Oct 2, 2024

Hej :)

It would be great if Sourcebot could handle local directory with one or more git repositories.

(Also, any pointers can be useful to implement such support by myself - also great learning) :)

Thanks! :)

@brendan-kellam brendan-kellam added the enhancement New feature or request label Oct 2, 2024
@mdaniel
Copy link

mdaniel commented Oct 5, 2024

(Also, any pointers can be useful to implement such support by myself - also great learning) :)

I had a similar need, made worse by the fact that the repo I wanted indexed was several gigs and thus I didn't want sourcebot to reclone it since I already have it locally

So, I cheated and just moved the .git into the directory that zoekt-mirror-github was expecting:

mkdir -p /data/.sourcebot/repos/github.com/ExAmPlEOrG/my-awesome-repo
mv $WHATEVER/.git /data/.sourcebot/repos/github.com/ExAmPlEOrG/my-awesome-repo
docker run ...

if that work-around is good enough for your situation, too


The other trick I was going to try if that one didn't work was to stub out the GitHub API handlers inside sourcebot so the config would say

  "Configs": [
    {
      "Type": "github",
      "GitHubUrl": "http://127.0.0.1:3000/fake-github",
      "GitHubOrg": "whatever",
    }]

which would cause zoekt-mirror-github to request "http://127.0.0.1:3000/fake-github/api/v3/orgs/whatever/repos" and we're all friends. However, that trickery didn't work because zoekt assumes there are no path segments and it actually requested "http://127.0.0.1:3000/api/v3/orgs/whatever/repos" made worse by the fact that it requested it so early in the boot process that express wasn't running yet, causing it to "dial tcp 127.0.0.1:3000: connect: connection refused"

@brendan-kellam
Copy link
Contributor

We are planning on doing some refactoring of how repositories cloned and managed soon. We will include local repository support as requirement. For now, @mdaniel's first solution is a good workaround currently.

Another option is zoekt includes a zoekt-git-index command, which can be used to index local git repositories and produce a .zoekt index. You could try using that command and placing the produced index files into .sourcebot/index

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants