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
1020 1020
1021 assert.equal(update, null);1021 assert.equal(update, null);
1022 });1022 });
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 });
1023});1032});
1024 1033
1025describe("resolveAutoFeatureBranchName", () => {1034describe("resolveAutoFeatureBranchName", () => {
apps/web/src/components/GitActionsControl.logic.ts+0−1
@@ -12,5 +12,4 @@ export { · 11 unmodified lines
12 resolveQuickAction,12 resolveQuickAction,
13 resolveThreadBranchUpdate,13 resolveThreadBranchUpdate,
14} from "@t3tools/client-runtime";14} from "@t3tools/client-runtime";
15
16export { resolveAutoFeatureBranchName } from "@t3tools/shared/git";15export { resolveAutoFeatureBranchName } from "@t3tools/shared/git";
packages/client-runtime/src/gitActions.ts+10−0
@@ -4,6 +4,7 @@ import type { · 3 unmodified lines
4 GitStackedAction,4 GitStackedAction,
5 GitStatusResult,5 GitStatusResult,
6} from "@t3tools/contracts";6} from "@t3tools/contracts";
7import { isTemporaryWorktreeBranch } from "@t3tools/shared/git";
7 8
8export type GitActionIconName = "commit" | "push" | "pr";9export type GitActionIconName = "commit" | "push" | "pr";
9 10
@@ -424,6 +425,15 @@ export function resolveLiveThreadBranchUpdate(input: { · 414 unmodified lines
424 return null;425 return null;
425 }426 }
426 427
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
427 return {437 return {
428 branch: input.gitStatus.branch,438 branch: input.gitStatus.branch,
429 };439 };