({
path,
}: {
path: string,
})
| 464 | * Returns true if the git repository at the given path has no commits. |
| 465 | */ |
| 466 | export 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. |
no test coverage detected