| author | |
| committer | |
| log | cc37865c2defa56cd753dfc6bf61e7371fa3f059 |
| tree | 89f8c39c331f690f800b59b1b89d6247ce498a0b |
| parent | a6b9ece840989e615e3cfc443524d71f4cac6f42 |
- Include branch-based remote target in push progress text
- Update logic and tests for commit+push and force-push flows3 files changed, 14 insertions(+), 4 deletions(-)
apps/web/src/components/GitActionsControl.logic.test.ts+8-2| ... | @@ -604,8 +604,9 @@ describe("buildGitActionProgressStages", () => { | ... | @@ -604,8 +604,9 @@ describe("buildGitActionProgressStages", () => { |
| 604 | hasCustomCommitMessage: false, | 604 | hasCustomCommitMessage: false, |
| 605 | hasWorkingTreeChanges: true, | 605 | hasWorkingTreeChanges: true, |
| 606 | forcePushOnly: true, | 606 | forcePushOnly: true, |
| 607 | pushTarget: "origin/feature/test", | ||
| 607 | }); | 608 | }); |
| 608 | assert.deepEqual(stages, ["Pushing..."]); | 609 | assert.deepEqual(stages, ["Pushing to origin/feature/test..."]); |
| 609 | }); | 610 | }); |
| 610 | 611 | ||
| 611 | it("includes commit stages for commit+push when working tree is dirty", () => { | 612 | it("includes commit stages for commit+push when working tree is dirty", () => { |
| ... | @@ -613,8 +614,13 @@ describe("buildGitActionProgressStages", () => { | ... | @@ -613,8 +614,13 @@ describe("buildGitActionProgressStages", () => { |
| 613 | action: "commit_push", | 614 | action: "commit_push", |
| 614 | hasCustomCommitMessage: false, | 615 | hasCustomCommitMessage: false, |
| 615 | hasWorkingTreeChanges: true, | 616 | hasWorkingTreeChanges: true, |
| 617 | pushTarget: "origin/feature/test", | ||
| 616 | }); | 618 | }); |
| 617 | assert.deepEqual(stages, ["Generating commit message...", "Committing...", "Pushing..."]); | 619 | assert.deepEqual(stages, [ |
| 620 | "Generating commit message...", | ||
| 621 | "Committing...", | ||
| 622 | "Pushing to origin/feature/test...", | ||
| 623 | ]); | ||
| 618 | }); | 624 | }); |
| 619 | }); | 625 | }); |
| 620 | 626 |
apps/web/src/components/GitActionsControl.logic.ts+4-2| ... | @@ -48,6 +48,7 @@ export function buildGitActionProgressStages(input: { | ... | @@ -48,6 +48,7 @@ export function buildGitActionProgressStages(input: { |
| 48 | hasCustomCommitMessage: boolean; | 48 | hasCustomCommitMessage: boolean; |
| 49 | hasWorkingTreeChanges: boolean; | 49 | hasWorkingTreeChanges: boolean; |
| 50 | forcePushOnly?: boolean; | 50 | forcePushOnly?: boolean; |
| 51 | pushTarget?: string; | ||
| 51 | }): string[] { | 52 | }): string[] { |
| 52 | const shouldIncludeCommitStages = | 53 | const shouldIncludeCommitStages = |
| 53 | !input.forcePushOnly && (input.action === "commit" || input.hasWorkingTreeChanges); | 54 | !input.forcePushOnly && (input.action === "commit" || input.hasWorkingTreeChanges); |
| ... | @@ -56,13 +57,14 @@ export function buildGitActionProgressStages(input: { | ... | @@ -56,13 +57,14 @@ export function buildGitActionProgressStages(input: { |
| 56 | : input.hasCustomCommitMessage | 57 | : input.hasCustomCommitMessage |
| 57 | ? ["Committing..."] | 58 | ? ["Committing..."] |
| 58 | : ["Generating commit message...", "Committing..."]; | 59 | : ["Generating commit message...", "Committing..."]; |
| 60 | const pushStage = input.pushTarget ? `Pushing to ${input.pushTarget}...` : "Pushing..."; | ||
| 59 | if (input.action === "commit") { | 61 | if (input.action === "commit") { |
| 60 | return commitStages; | 62 | return commitStages; |
| 61 | } | 63 | } |
| 62 | if (input.action === "commit_push") { | 64 | if (input.action === "commit_push") { |
| 63 | return [...commitStages, "Pushing..."]; | 65 | return [...commitStages, pushStage]; |
| 64 | } | 66 | } |
| 65 | return [...commitStages, "Pushing...", "Creating PR..."]; | 67 | return [...commitStages, pushStage, "Creating PR..."]; |
| 66 | } | 68 | } |
| 67 | 69 | ||
| 68 | export function summarizeGitResult(result: GitRunStackedActionResult): { | 70 | export function summarizeGitResult(result: GitRunStackedActionResult): { |
apps/web/src/components/GitActionsControl.tsx+2| ... | @@ -226,11 +226,13 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp | ... | @@ -226,11 +226,13 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp |
| 226 | if (!confirmed) return; | 226 | if (!confirmed) return; |
| 227 | onConfirmed?.(); | 227 | onConfirmed?.(); |
| 228 | 228 | ||
| 229 | const pushTarget = gitStatus?.branch ? `origin/${gitStatus.branch}` : undefined; | ||
| 229 | const progressStages = buildGitActionProgressStages({ | 230 | const progressStages = buildGitActionProgressStages({ |
| 230 | action, | 231 | action, |
| 231 | hasCustomCommitMessage: !!commitMessage?.trim(), | 232 | hasCustomCommitMessage: !!commitMessage?.trim(), |
| 232 | hasWorkingTreeChanges: !!gitStatus?.hasWorkingTreeChanges, | 233 | hasWorkingTreeChanges: !!gitStatus?.hasWorkingTreeChanges, |
| 233 | forcePushOnly: forcePushOnlyProgress, | 234 | forcePushOnly: forcePushOnlyProgress, |
| 235 | pushTarget, | ||
| 234 | }); | 236 | }); |
| 235 | const progressToastId = toastManager.add({ | 237 | const progressToastId = toastManager.add({ |
| 236 | type: "loading", | 238 | type: "loading", |