MCPcopy Index your code
hub / github.com/sourcebot-dev/sourcebot / isRepoEmpty

Function isRepoEmpty

packages/backend/src/git.ts:466–478  ·  view source on GitHub ↗
({
    path,
}: {
    path: string,
})

Source from the content-addressed store, hash-verified

464 * Returns true if the git repository at the given path has no commits.
465 */
466export const isRepoEmpty = async ({
467 path,
468}: {
469 path: string,
470}): Promise<boolean> => {
471 const git = createGitClientForPath(path);
472 try {
473 const result = await git.raw(['log', '--all', '-1', '--format=%H']);
474 return result.trim() === '';
475 } catch {
476 return true;
477 }
478}
479
480/**
481 * Writes or updates the commit-graph file for the repository.

Callers 1

onJobCompletedMethod · 0.85

Calls 1

createGitClientForPathFunction · 0.85

Tested by

no test coverage detected