History

Prevent live thread branches from regressing to temp worktree names (#1995)

Julius Marminge committed 7 months ago

Commit f7535bb1 parent cea78b13 files · +19 −1Browse files

Unified · Split

3 files
  1. apps/web/src/components/GitActionsControl.logic.test.ts +9 −0
  2. apps/web/src/components/GitActionsControl.logic.ts +0 −1
  3. packages/client-runtime/src/gitActions.ts +10 −0
apps/web/src/components/GitActionsControl.logic.test.ts+9−0
@@ -1020,6 +1020,15 @@ describe("resolveLiveThreadBranchUpdate", () => { · 1019 unmodified lines
10201020
10211021 assert.equal(update, null);
10221022 });
1023+
1024+ it("does not regress a semantic thread branch back to a temporary worktree branch", () => {
1025+ const update = resolveLiveThreadBranchUpdate({
1026+ threadBranch: "t3code/github-query-rate-limit",
1027+ gitStatus: status({ branch: "t3code/bda76797" }),
1028+ });
1029+
1030+ assert.equal(update, null);
1031+ });
10231032 });
10241033
10251034 describe("resolveAutoFeatureBranchName", () => {
apps/web/src/components/GitActionsControl.logic.ts+0−1
@@ -12,5 +12,4 @@ export { · 11 unmodified lines
1212 resolveQuickAction,
1313 resolveThreadBranchUpdate,
1414 } from "@t3tools/client-runtime";
15−
1615 export { resolveAutoFeatureBranchName } from "@t3tools/shared/git";
packages/client-runtime/src/gitActions.ts+10−0
@@ -4,6 +4,7 @@ import type { · 3 unmodified lines
44 GitStackedAction,
55 GitStatusResult,
66 } from "@t3tools/contracts";
7+import { isTemporaryWorktreeBranch } from "@t3tools/shared/git";
78
89 export type GitActionIconName = "commit" | "push" | "pr";
910
@@ -424,6 +425,15 @@ export function resolveLiveThreadBranchUpdate(input: { · 414 unmodified lines
424425 return null;
425426 }
426427
428+ if (
429+ input.threadBranch !== null &&
430+ input.gitStatus.branch !== null &&
431+ !isTemporaryWorktreeBranch(input.threadBranch) &&
432+ isTemporaryWorktreeBranch(input.gitStatus.branch)
433+ ) {
434+ return null;
435+ }
436+
427437 return {
428438 branch: input.gitStatus.branch,
429439 };