The best way to control Claude Code, Codex and more from any computer or phone
Require ahead commits before offering Create PR on untracked branches
- Change quick action to `Push` (not `Push & create PR`) when branch has no upstream and is not ahead - Keep `Create PR` menu item disabled until the branch has commits ahead - Add/adjust logic tests for both no-ahead and ahead scenarios
Julius Marminge committed
Mar 1, 2026 at 11:07 UTC
0e2d50a62082aefb14249b85691cc500d4dd35dc
2 files changed
+58
-5
apps/web/src/components/GitActionsControl.logic.test.ts
+54
-4
@@ -515,15 +515,15 @@ describe("when: HEAD is detached and there are no local changes", () => {
515
});
516
517
describe("when: branch has no upstream configured", () => {
518
- it("resolveQuickAction runs push and create PR when clean, no upstream, and no local commits are ahead", () => {
518
+ it("resolveQuickAction runs push when clean, no upstream, and no local commits are ahead", () => {
519
const quick = resolveQuickAction(
520
status({ hasUpstream: false, pr: null, aheadCount: 0 }),
521
false,
522
);
523
assert.deepInclude(quick, {
524
kind: "run_action",
525
- action: "commit_push_pr",
526
- label: "Push & create PR",
525
+ action: "commit_push",
526
+ label: "Push",
527
disabled: false,
528
});
529
});
@@ -576,11 +576,61 @@ describe("when: branch has no upstream configured", () => {
576
});
577
});
578
579
- it("buildMenuItems enables push and create PR to publish branch when no upstream exists", () => {
579
+ it("buildMenuItems enables push but keeps create PR disabled when no commits are ahead", () => {
580
const items = buildMenuItems(
581
status({ hasUpstream: false, pr: null, aheadCount: 0 }),
582
false,
583
);
584
+ assert.deepEqual(items, [
585
+ {
586
+ id: "commit",
587
+ label: "Commit",
588
+ disabled: true,
589
+ icon: "commit",
590
+ kind: "open_dialog",
591
+ dialogAction: "commit",
592
+ },
593
+ {
594
+ id: "push",
595
+ label: "Push",
596
+ disabled: false,
597
+ icon: "push",
598
+ kind: "open_dialog",
599
+ dialogAction: "push",
600
+ },
601
+ {
602
+ id: "pr",
603
+ label: "Create PR",
604
+ disabled: true,
605
+ icon: "pr",
606
+ kind: "open_dialog",
607
+ dialogAction: "create_pr",
608
+ },
609
+ ]);
610
+ });
611
+
612
+ it("resolveQuickAction runs push and create PR when no upstream and commits are ahead", () => {
613
+ const quick = resolveQuickAction(
614
+ status({
615
+ hasUpstream: false,
616
+ aheadCount: 2,
617
+ pr: null,
618
+ }),
619
+ false,
620
+ );
621
+ assert.deepInclude(quick, {
622
+ kind: "run_action",
623
+ action: "commit_push_pr",
624
+ label: "Push & create PR",
625
+ disabled: false,
626
+ });
627
+ });
628
+
629
+ it("buildMenuItems enables create PR when no upstream and commits are ahead", () => {
630
+ const items = buildMenuItems(
631
+ status({ hasUpstream: false, pr: null, aheadCount: 2 }),
632
+ false,
633
+ );
634
assert.deepEqual(items, [
635
{
636
id: "commit",
apps/web/src/components/GitActionsControl.logic.ts
+4
-1
@@ -124,7 +124,7 @@ export function buildMenuItems(
124
hasBranch &&
125
!hasChanges &&
126
!hasOpenPr &&
127
- (gitStatus.aheadCount > 0 || canPublishUntrackedBranch) &&
127
+ gitStatus.aheadCount > 0 &&
128
!isBehind;
129
const canOpenPr = !isBusy && hasOpenPr;
130
@@ -214,6 +214,9 @@ export function resolveQuickAction(
214
if (hasOpenPr || isDefaultBranch) {
215
return { label: "Push", disabled: false, kind: "run_action", action: "commit_push" };
216
}
217
+ if (!isAhead) {
218
+ return { label: "Push", disabled: false, kind: "run_action", action: "commit_push" };
219
+ }
220
return {
221
label: "Push & create PR",
222
disabled: false,