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

Hitting error `getCommit("refs/heads/", "HEAD")` when a repository is empty #72

Closed brendan-kellam closed 1 week ago

brendan-kellam commented 1 week ago

Repro Steps

  1. Create a new, empty repository in GitHub (or other supported code host)
  2. Add the repo to a config.json
  3. Run Sourcebot

Expected

Sourcebot should ignore empty repositories as there is nothing to index.

Actual

Hit the following issue:

[dev:backend] Error: Command failed: zoekt-git-index -index ../../.sourcebot/index -branches HEAD .sourcebot/repos/github.com/sourcebot-dev/<repo>.git
[dev:backend] 2024/11/14 14:57:28 indexGitRepo(.sourcebot/repos/github.com/sourcebot-dev/<repo>.git, delta=false): getCommit("refs/heads/", "HEAD"): reference not found

Related #59