Skip branch updates on detached HEAD

- Keep the existing thread branch when git status has no branch
- Add regression coverage for detached-HEAD branch updates
This commit is contained in:
Julius Marminge committed 2026-04-01 14:30:19 -07:00
1 parent 6b7c570fac
commit 604bdb8367
2 files changed
+13

No files matched your search

@@ -981,6 +981,15 @@ describe("resolveLiveThreadBranchUpdate", () => {
assert.equal(update, null);
});
it("returns null when git status is detached HEAD but the thread already has a branch", () => {
const update = resolveLiveThreadBranchUpdate({
threadBranch: "effect-atom",
gitStatus: status({ branch: null }),
});
assert.equal(update, null);
});
});
describe("resolveAutoFeatureBranchName", () => {
@@ -320,6 +320,10 @@ export function resolveLiveThreadBranchUpdate(input: {
return null;
}
if (input.gitStatus.branch === null && input.threadBranch !== null) {
return null;
}
if (input.threadBranch === input.gitStatus.branch) {
return null;
}