Skip to content

Commit d694330

Browse files
fix(worker): Fix "attempting to index 0 total files" zoekt issue (#488)
1 parent e317407 commit d694330

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
- 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)
12+
1013
## [4.6.5] - 2025-09-02
1114

1215
### Fixed

packages/backend/src/git.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,19 @@ export const cloneRepository = async (
1818
path,
1919
})
2020

21-
await git.init(/*bare = */ true);
22-
23-
await git.fetch([
21+
await git.clone(
2422
remoteUrl.toString(),
25-
// See https://git-scm.com/book/en/v2/Git-Internals-The-Refspec
26-
"+refs/heads/*:refs/heads/*",
27-
"--progress",
28-
]);
23+
path,
24+
[
25+
"--bare",
26+
]
27+
);
28+
29+
await unsetGitConfig(path, ["remote.origin.url"]);
30+
31+
await git.cwd({
32+
path,
33+
}).addConfig("remote.origin.fetch", "+refs/heads/*:refs/heads/*");
2934
} catch (error: unknown) {
3035
const baseLog = `Failed to clone repository: ${path}`;
3136

@@ -54,7 +59,6 @@ export const fetchRepository = async (
5459

5560
await git.fetch([
5661
remoteUrl.toString(),
57-
"+refs/heads/*:refs/heads/*",
5862
"--prune",
5963
"--progress"
6064
]);

0 commit comments

Comments
 (0)