()
| 394 | * @returns True if the repository is clean |
| 395 | */ |
| 396 | export async function isRepoClean(): Promise<boolean> { |
| 397 | const cmd = new Deno.Command("git", { |
| 398 | args: ["status", "--porcelain"], |
| 399 | stdout: "piped", |
| 400 | stderr: "piped", |
| 401 | }); |
| 402 | |
| 403 | const output = await cmd.output(); |
| 404 | if (!output.success) { |
| 405 | const errorOutput = new TextDecoder().decode(output.stderr); |
| 406 | await logMessage("error", `Checking repo status failed: ${errorOutput}`); |
| 407 | throw new Error(`Checking repo status failed: ${errorOutput}`); |
| 408 | } |
| 409 | |
| 410 | const statusText = new TextDecoder().decode(output.stdout); |
| 411 | |
| 412 | return statusText.trim() === ""; |
| 413 | } |
no test coverage detected