fix: restore input on submission error and enforce clean working tree for git operations

This commit is contained in:
Mohamed Boudra
2025-12-27 09:35:40 +07:00
parent 40835bbe9d
commit 95c821a4c6
3 changed files with 29 additions and 13 deletions
+2 -4
View File
@@ -1503,10 +1503,6 @@ export class Session {
};
}
if (!normalized.createWorktree) {
await this.ensureCleanWorkingTree(cwd);
}
if (normalized.createWorktree) {
const targetBranch = normalized.createNewBranch
? normalized.newBranchName
@@ -1751,6 +1747,7 @@ export class Session {
return;
}
await this.ensureCleanWorkingTree(cwd);
await execAsync(`git checkout ${branch}`, { cwd });
}
@@ -1773,6 +1770,7 @@ export class Session {
throw new Error(`Branch already exists: ${newBranchName}`);
}
await this.ensureCleanWorkingTree(cwd);
await execAsync(`git checkout -b ${newBranchName} ${baseBranch}`, {
cwd,
});