Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

Require ahead commits before offering Create PR on untracked branches

Julius Marminge0e2d50a62082
diff --git a/apps/web/src/components/GitActionsControl.logic.test.ts b/apps/web/src/components/GitActionsControl.logic.test.ts
index c725da105..35b5a48e3 100644
--- a/apps/web/src/components/GitActionsControl.logic.test.ts
+++ b/apps/web/src/components/GitActionsControl.logic.test.ts
@@ -515,15 +515,15 @@ describe("when: HEAD is detached and there are no local changes", () => {
});
describe("when: branch has no upstream configured", () => {
- it("resolveQuickAction runs push and create PR when clean, no upstream, and no local commits are ahead", () => {
+ it("resolveQuickAction runs push when clean, no upstream, and no local commits are ahead", () => {
const quick = resolveQuickAction(
status({ hasUpstream: false, pr: null, aheadCount: 0 }),
false,
);
assert.deepInclude(quick, {
kind: "run_action",
- action: "commit_push_pr",
- label: "Push & create PR",
+ action: "commit_push",
+ label: "Push",
disabled: false,
});
});
@@ -576,11 +576,61 @@ describe("when: branch has no upstream configured", () => {
});
});
- it("buildMenuItems enables push and create PR to publish branch when no upstream exists", () => {
+ it("buildMenuItems enables push but keeps create PR disabled when no commits are ahead", () => {
const items = buildMenuItems(
status({ hasUpstream: false, pr: null, aheadCount: 0 }),
false,
);
+ assert.deepEqual(items, [
+ {
+ id: "commit",
+ label: "Commit",
+ disabled: true,
+ icon: "commit",
+ kind: "open_dialog",
+ dialogAction: "commit",
+ },
+ {
+ id: "push",
+ label: "Push",
+ disabled: false,
+ icon: "push",
+ kind: "open_dialog",
+ dialogAction: "push",
+ },
+ {
+ id: "pr",
+ label: "Create PR",
+ disabled: true,
+ icon: "pr",
+ kind: "open_dialog",
+ dialogAction: "create_pr",
+ },
+ ]);
+ });
+
+ it("resolveQuickAction runs push and create PR when no upstream and commits are ahead", () => {
+ const quick = resolveQuickAction(
+ status({
+ hasUpstream: false,
+ aheadCount: 2,
+ pr: null,
+ }),
+ false,
+ );
+ assert.deepInclude(quick, {
+ kind: "run_action",
+ action: "commit_push_pr",
+ label: "Push & create PR",
+ disabled: false,
+ });
+ });
+
+ it("buildMenuItems enables create PR when no upstream and commits are ahead", () => {
+ const items = buildMenuItems(
+ status({ hasUpstream: false, pr: null, aheadCount: 2 }),
+ false,
+ );
assert.deepEqual(items, [
{
id: "commit",
diff --git a/apps/web/src/components/GitActionsControl.logic.ts b/apps/web/src/components/GitActionsControl.logic.ts
index bebdd2e07..4c669d9d5 100644
--- a/apps/web/src/components/GitActionsControl.logic.ts
+++ b/apps/web/src/components/GitActionsControl.logic.ts
@@ -124,7 +124,7 @@ export function buildMenuItems(
hasBranch &&
!hasChanges &&
!hasOpenPr &&
- (gitStatus.aheadCount > 0 || canPublishUntrackedBranch) &&
+ gitStatus.aheadCount > 0 &&
!isBehind;
const canOpenPr = !isBusy && hasOpenPr;
@@ -214,6 +214,9 @@ export function resolveQuickAction(
if (hasOpenPr || isDefaultBranch) {
return { label: "Push", disabled: false, kind: "run_action", action: "commit_push" };
}
+ if (!isAhead) {
+ return { label: "Push", disabled: false, kind: "run_action", action: "commit_push" };
+ }
return {
label: "Push & create PR",
disabled: false,