fix(worker): Fix "attempting to index 0 total files" zoekt issue (#488)

This commit is contained in:
Brendan Kellam 2025-09-04 11:14:29 -04:00 committed by GitHub
parent e31740773e
commit d694330998
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 8 deletions

View file

@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
### Fixed
- Fix issue where zoekt was failing to index repositories due to `HEAD` pointing to a branch that does not exist. [#488](https://github.com/sourcebot-dev/sourcebot/pull/488)
## [4.6.5] - 2025-09-02 ## [4.6.5] - 2025-09-02
### Fixed ### Fixed

View file

@ -18,14 +18,19 @@ export const cloneRepository = async (
path, path,
}) })
await git.init(/*bare = */ true); await git.clone(
await git.fetch([
remoteUrl.toString(), remoteUrl.toString(),
// See https://git-scm.com/book/en/v2/Git-Internals-The-Refspec path,
"+refs/heads/*:refs/heads/*", [
"--progress", "--bare",
]); ]
);
await unsetGitConfig(path, ["remote.origin.url"]);
await git.cwd({
path,
}).addConfig("remote.origin.fetch", "+refs/heads/*:refs/heads/*");
} catch (error: unknown) { } catch (error: unknown) {
const baseLog = `Failed to clone repository: ${path}`; const baseLog = `Failed to clone repository: ${path}`;
@ -54,7 +59,6 @@ export const fetchRepository = async (
await git.fetch([ await git.fetch([
remoteUrl.toString(), remoteUrl.toString(),
"+refs/heads/*:refs/heads/*",
"--prune", "--prune",
"--progress" "--progress"
]); ]);