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 25, 11:00 UTC
Fix duplicated branch logic and feature-branch dialog on push-only
Deduplicate feature/ prefix logic in resolveAutoFeatureBranchName by delegating to sanitizeFeatureBranchName. Skip the default-branch confirmation dialog when there are no uncommitted changes (push-only), since runFeatureBranchStep requires dirty worktree. Add merge-base assertions to feature branch tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Julius Marminge committed
Mar 2, 2026 at 14:35 UTC
61289a152d7c655a3239ff9c9cfef4ee3bd9f6c0
3 files changed
+19
-7
apps/server/src/git/Layers/GitManager.test.ts
+16
@@ -563,6 +563,14 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
563
Effect.map((result) => result.stdout.trim()),
564
),
565
).toBe("feature/implement-stacked-git-actions");
566
+
567
+ const mainSha = yield* runGit(repoDir, ["rev-parse", "main"]).pipe(
568
+ Effect.map((r) => r.stdout.trim()),
569
+ );
570
+ const mergeBase = yield* runGit(repoDir, ["merge-base", "main", "HEAD"]).pipe(
571
+ Effect.map((r) => r.stdout.trim()),
572
+ );
573
+ expect(mergeBase).toBe(mainSha);
574
}),
575
);
576
@@ -598,6 +606,14 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
606
expect(result.commit.status).toBe("created");
607
expect(result.commit.subject).toBe("feat: custom summary line");
608
expect(generatedCount).toBe(0);
609
+
610
+ const mainSha = yield* runGit(repoDir, ["rev-parse", "main"]).pipe(
611
+ Effect.map((r) => r.stdout.trim()),
612
+ );
613
+ const mergeBase = yield* runGit(repoDir, ["merge-base", "main", result.branch.name!]).pipe(
614
+ Effect.map((r) => r.stdout.trim()),
615
+ );
616
+ expect(mergeBase).toBe(mainSha);
617
}),
618
);
619
apps/web/src/components/GitActionsControl.tsx
+2
-1
@@ -254,7 +254,8 @@ export default function GitActionsControl({ gitCwd, activeThreadId }: GitActions
254
!skipDefaultBranchPrompt &&
255
!featureBranch &&
256
requiresDefaultBranchConfirmation(action, actionIsDefaultBranch) &&
257
- actionBranch
257
+ actionBranch &&
258
+ !!actionStatus?.hasWorkingTreeChanges
259
) {
260
if (action !== "commit_push" && action !== "commit_push_pr") {
261
return;
packages/shared/src/git.ts
+1
-6
@@ -43,14 +43,9 @@ export function resolveAutoFeatureBranchName(
43
preferredBranch?: string,
44
): string {
45
const preferred = preferredBranch?.trim();
46
- const normalized = sanitizeBranchFragment(
46
+ const resolvedBase = sanitizeFeatureBranchName(
47
preferred && preferred.length > 0 ? preferred : AUTO_FEATURE_BRANCH_FALLBACK,
48
);
49
- const resolvedBase = normalized.includes("/")
50
- ? normalized.startsWith("feature/")
51
- ? normalized
52
- : `feature/${normalized}`
53
- : `feature/${normalized}`;
49
const existingNames = new Set(existingBranchNames);
50
51
if (!existingNames.has(resolvedBase)) {