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

Fix issue with empty branches #73

Closed brendan-kellam closed 1 week ago

brendan-kellam commented 1 week ago

Previously, indexing was failing for empty repositories with getCommit("refs/heads/", "HEAD"): reference not found. This PR adds the allow_missing_branches option to the zoekt-git-index call. This will make it s.t., a ref is skipped if it cannot be found.

Note for issue #59 : this might has the side-effect where if HEAD actually does reference something that exists, we will now silently fail (HEAD will not be indexed). We should follow up by raising a warning message when HEAD doesn't reference anything.