diff --git a/src/utils/try-init-git.ts b/src/utils/try-init-git.ts index a3af86d..e627bd4 100644 --- a/src/utils/try-init-git.ts +++ b/src/utils/try-init-git.ts @@ -1,6 +1,3 @@ -import path from "path"; -import fs from "fs/promises"; - import { exec } from "./async-exec"; async function isInGitRepository(projectDirectory: string): Promise { @@ -18,7 +15,9 @@ async function isInMercurialRepository( projectDirectory: string ): Promise { try { - await exec("hg --cwd . root", { cwd: projectDirectory }); + await exec("hg --cwd . root", { + cwd: projectDirectory, + }); return true; } catch { return false; @@ -27,14 +26,18 @@ async function isInMercurialRepository( export async function tryGitInit(projectDirectory: string): Promise { try { - await exec("git --version", { cwd: projectDirectory }); + await exec("git --version", { + cwd: projectDirectory, + }); if ( (await isInGitRepository(projectDirectory)) || (await isInMercurialRepository(projectDirectory)) ) { return false; } - await exec("git init"); + await exec("git init", { + cwd: projectDirectory, + }); return true; } catch { return false;