File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import { env } from "@sourcebot/shared" ;
1+ import { env , createLogger } from "@sourcebot/shared" ;
22import { existsSync } from 'node:fs' ;
33import { mkdir } from 'node:fs/promises' ;
44import { dirname , resolve } from 'node:path' ;
55import { CheckRepoActions , GitConfigScope , simpleGit , SimpleGitProgressEvent } from 'simple-git' ;
66
77type onProgressFn = ( event : SimpleGitProgressEvent ) => void ;
88
9+ const logger = createLogger ( 'git-utils' ) ;
10+
911/**
1012 * Creates a simple-git client that has it's working directory
1113 * set to the given path.
@@ -288,7 +290,11 @@ export const getCommitHashForRefName = async ({
288290 // The `^{commit}` suffix is used to fully dereference the ref to a commit hash.
289291 const rev = await git . revparse ( `${ refName } ^{commit}` ) ;
290292 return rev ;
293+
294+ // @note : Was hitting errors when the repository is empty,
295+ // so we're catching the error and returning undefined.
291296 } catch ( error : unknown ) {
297+ logger . debug ( error ) ;
292298 return undefined ;
293299 }
294300}
You can’t perform that action at this time.
0 commit comments