fix: diff

This commit is contained in:
Nate 2025-07-21 09:24:33 -07:00
parent 4eefd16dff
commit 7808b6d160
2 changed files with 8 additions and 3 deletions

View file

@ -153,8 +153,13 @@ export async function serve(prompt?: string, options: ServeOptions = {}) {
diff: stdout,
});
} catch (error: any) {
// Handle case where we're not in a git repo or main branch doesn't exist
if (error.code === 128) {
// Git diff returns exit code 1 when there are differences, which is normal
if (error.code === 1 && error.stdout) {
res.json({
diff: error.stdout,
});
} else if (error.code === 128) {
// Handle case where we're not in a git repo or main branch doesn't exist
res.status(404).json({
error: "Not in a git repository or main branch doesn't exist",
diff: ""

View file

@ -103,7 +103,7 @@ describe("E2E: Headless Mode with Dynamic Responses", () => {
expect(result.stdout).toContain("Non-streaming response");
expect(result.exitCode).toBe(0);
});
}, 20000);
it("should handle multiple mock servers for different models", async () => {
context = await createTestContext();