From de621d6dea7b11e40d39ae29023dcdaa93dc5bba Mon Sep 17 00:00:00 2001 From: bkellam Date: Tue, 13 Jan 2026 15:53:58 -0800 Subject: [PATCH 1/3] fix --- packages/backend/src/git.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/backend/src/git.ts b/packages/backend/src/git.ts index 948b1f3bc..625070aea 100644 --- a/packages/backend/src/git.ts +++ b/packages/backend/src/git.ts @@ -288,11 +288,7 @@ export const getCommitHashForRefName = async ({ // The `^{commit}` suffix is used to fully dereference the ref to a commit hash. const rev = await git.revparse(`${refName}^{commit}`); return rev; - - // @note: Was hitting errors when the repository is empty, - // so we're catching the error and returning undefined. } catch (error: unknown) { - console.error(error); return undefined; } } \ No newline at end of file From f5458c4a77c8e7b37449c3f64244e4a241be6b3e Mon Sep 17 00:00:00 2001 From: bkellam Date: Tue, 13 Jan 2026 15:56:03 -0800 Subject: [PATCH 2/3] wip --- packages/backend/src/git.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/git.ts b/packages/backend/src/git.ts index 625070aea..899770017 100644 --- a/packages/backend/src/git.ts +++ b/packages/backend/src/git.ts @@ -1,4 +1,4 @@ -import { env } from "@sourcebot/shared"; +import { env, createLogger } from "@sourcebot/shared"; import { existsSync } from 'node:fs'; import { mkdir } from 'node:fs/promises'; import { dirname, resolve } from 'node:path'; @@ -6,6 +6,8 @@ import { CheckRepoActions, GitConfigScope, simpleGit, SimpleGitProgressEvent } f type onProgressFn = (event: SimpleGitProgressEvent) => void; +const logger = createLogger('git-utils'); + /** * Creates a simple-git client that has it's working directory * set to the given path. @@ -288,7 +290,11 @@ export const getCommitHashForRefName = async ({ // The `^{commit}` suffix is used to fully dereference the ref to a commit hash. const rev = await git.revparse(`${refName}^{commit}`); return rev; + + // @note: Was hitting errors when the repository is empty, + // so we're catching the error and returning undefined. } catch (error: unknown) { + logger.debug(error); return undefined; } } \ No newline at end of file From 9c02d8e84b5f65435120adeb62fa361ef2c3da43 Mon Sep 17 00:00:00 2001 From: bkellam Date: Tue, 13 Jan 2026 15:59:49 -0800 Subject: [PATCH 3/3] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8b040bd3..ab382ac3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fixed issue where 403 errors were being raised during a user driven permission sync against a self-hosted code host. [#729](https://github.com/sourcebot-dev/sourcebot/pull/729) +- Fixed "ambiguous argument 'HEAD^{commit}': unknown revision or path not in the working tree" error for blank repositories. [#733](https://github.com/sourcebot-dev/sourcebot/pull/733) ## [4.10.8] - 2026-01-13