@devries-cameron20 / t3code Mirror · read-only / commits / 7241e7ee50
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 23, 04:15 UTC

fix(web): the default-branch dialog no longer offers a feature branch it cannot create (#18716)

Igor Makowski committed Oct 18, 2026 at 21:09 UTC 7241e7ee5098522926ae5e8ff11c12b97b9d4e68
3 files changed +42 -1
apps/web/src/components/GitActionsControl.logic.test.ts
+16
@@ -8,6 +8,7 @@ import {
8 requiresDefaultBranchConfirmation,
9 resolveAutoFeatureBranchName,
10 resolveDefaultBranchActionDialogCopy,
11 + resolveFeatureBranchUnavailableReason,
12 resolveGitActionProgressPresentation,
13 resolveGitActionResultToastTiming,
14 resolveLiveThreadBranchUpdate,
@@ -1025,6 +1026,21 @@ describe("resolveDefaultBranchActionDialogCopy", () => {
1026 });
1027 });
1028
1029 +describe("resolveFeatureBranchUnavailableReason", () => {
1030 + it("blocks the feature branch when there is nothing to commit", () => {
1031 + assert.equal(
1032 + resolveFeatureBranchUnavailableReason({ branchName: "main", hasWorkingTreeChanges: false }),
1033 + "There are no changes to commit, so a feature branch can't be named. Create a branch yourself or continue on main.",
1034 + );
1035 + });
1036 +
1037 + it("allows the feature branch when there are changes to commit", () => {
1038 + assert.isNull(
1039 + resolveFeatureBranchUnavailableReason({ branchName: "main", hasWorkingTreeChanges: true }),
1040 + );
1041 + });
1042 +});
1043 +
1044 describe("buildGitActionProgressStages", () => {
1045 it("shows only push progress for explicit push actions", () => {
1046 const stages = buildGitActionProgressStages({
apps/web/src/components/GitActionsControl.logic.ts
+12
@@ -428,6 +428,18 @@ export function resolveDefaultBranchActionDialogCopy(input: {
428 };
429 }
430
431 +/**
432 + * Why the default-ref dialog cannot check out a feature branch, or null when it can.
433 + * The server names that branch from the uncommitted changes, so a clean tree cannot use it.
434 + */
435 +export function resolveFeatureBranchUnavailableReason(input: {
436 + branchName: string;
437 + hasWorkingTreeChanges: boolean;
438 +}): string | null {
439 + if (input.hasWorkingTreeChanges) return null;
440 + return `There are no changes to commit, so a feature branch can't be named. Create a branch yourself or continue on ${input.branchName}.`;
441 +}
442 +
443 export function resolveThreadBranchUpdate(
444 result: GitRunStackedActionResult,
445 ): { branch: string } | null {
apps/web/src/components/GitActionsControl.tsx
+14 -1
@@ -52,6 +52,7 @@ import {
52 type DefaultBranchConfirmableAction,
53 requiresDefaultBranchConfirmation,
54 resolveDefaultBranchActionDialogCopy,
55 + resolveFeatureBranchUnavailableReason,
56 resolveGitActionProgressPresentation,
57 resolveGitActionResultToastTiming,
58 resolveLiveThreadBranchUpdate,
@@ -1155,6 +1156,15 @@ export default function GitActionsControl({
1156 terminology: changeRequestTerminology,
1157 })
1158 : null;
1159 + // Follows the live status so the button tracks the tree while the dialog is open. Until the
1160 + // status loads, keep the option enabled: the server stays the authority and rejects a stale
1161 + // request with its own error.
1162 + const featureBranchUnavailableReason = pendingDefaultBranchAction
1163 + ? resolveFeatureBranchUnavailableReason({
1164 + branchName: pendingDefaultBranchAction.branchName,
1165 + hasWorkingTreeChanges: gitStatus?.hasWorkingTreeChanges ?? true,
1166 + })
1167 + : null;
1168
1169 useEffect(() => {
1170 if (gitCwd === null) {
@@ -2039,6 +2049,9 @@ export default function GitActionsControl({
2049 {pendingDefaultBranchActionCopy?.title ?? "Run action on default branch?"}
2050 </DialogTitle>
2051 <DialogDescription>{pendingDefaultBranchActionCopy?.description}</DialogDescription>
2052 + {featureBranchUnavailableReason && (
2053 + <p className="text-xs text-muted-foreground">{featureBranchUnavailableReason}</p>
2054 + )}
2055 </DialogHeader>
2056 <DialogFooter variant="bare" className="sm:flex-wrap sm:items-center">
2057 <Button
@@ -2062,7 +2075,7 @@ export default function GitActionsControl({
2075 className="w-full max-w-full sm:w-auto"
2076 size="sm-multiline"
2077 onClick={checkoutFeatureBranchAndContinuePendingAction}
2065 - disabled={!canChangeThreadBranch}
2078 + disabled={!canChangeThreadBranch || featureBranchUnavailableReason !== null}
2079 >
2080 Check out feature branch & continue
2081 </Button>