(cwd)
| 75 | } |
| 76 | |
| 77 | export function ensureGitRepository(cwd) { |
| 78 | const result = git(cwd, ["rev-parse", "--show-toplevel"]); |
| 79 | const errorCode = result.error && "code" in result.error ? result.error.code : null; |
| 80 | if (errorCode === "ENOENT") { |
| 81 | throw new Error("git is not installed. Install Git and retry."); |
| 82 | } |
| 83 | if (result.status !== 0) { |
| 84 | throw new Error("This command must run inside a Git repository."); |
| 85 | } |
| 86 | return result.stdout.trim(); |
| 87 | } |
| 88 | |
| 89 | export function getRepoRoot(cwd) { |
| 90 | return gitChecked(cwd, ["rev-parse", "--show-toplevel"]).stdout.trim(); |
no test coverage detected