Show push target in Git action progress stages
- Include branch-based remote target in push progress text - Update logic and tests for commit+push and force-push flows
This commit is contained in:
1 parent
a6b9ece840
commit
cc37865c2d
3 files changed
+14
-4
No files matched your search
@@ -604,8 +604,9 @@ describe("buildGitActionProgressStages", () => {
|
||||
hasCustomCommitMessage: false,
|
||||
hasWorkingTreeChanges: true,
|
||||
forcePushOnly: true,
|
||||
pushTarget: "origin/feature/test",
|
||||
});
|
||||
assert.deepEqual(stages, ["Pushing..."]);
|
||||
assert.deepEqual(stages, ["Pushing to origin/feature/test..."]);
|
||||
});
|
||||
|
||||
it("includes commit stages for commit+push when working tree is dirty", () => {
|
||||
@@ -613,8 +614,13 @@ describe("buildGitActionProgressStages", () => {
|
||||
action: "commit_push",
|
||||
hasCustomCommitMessage: false,
|
||||
hasWorkingTreeChanges: true,
|
||||
pushTarget: "origin/feature/test",
|
||||
});
|
||||
assert.deepEqual(stages, ["Generating commit message...", "Committing...", "Pushing..."]);
|
||||
assert.deepEqual(stages, [
|
||||
"Generating commit message...",
|
||||
"Committing...",
|
||||
"Pushing to origin/feature/test...",
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ export function buildGitActionProgressStages(input: {
|
||||
hasCustomCommitMessage: boolean;
|
||||
hasWorkingTreeChanges: boolean;
|
||||
forcePushOnly?: boolean;
|
||||
pushTarget?: string;
|
||||
}): string[] {
|
||||
const shouldIncludeCommitStages =
|
||||
!input.forcePushOnly && (input.action === "commit" || input.hasWorkingTreeChanges);
|
||||
@@ -56,13 +57,14 @@ export function buildGitActionProgressStages(input: {
|
||||
: input.hasCustomCommitMessage
|
||||
? ["Committing..."]
|
||||
: ["Generating commit message...", "Committing..."];
|
||||
const pushStage = input.pushTarget ? `Pushing to ${input.pushTarget}...` : "Pushing...";
|
||||
if (input.action === "commit") {
|
||||
return commitStages;
|
||||
}
|
||||
if (input.action === "commit_push") {
|
||||
return [...commitStages, "Pushing..."];
|
||||
return [...commitStages, pushStage];
|
||||
}
|
||||
return [...commitStages, "Pushing...", "Creating PR..."];
|
||||
return [...commitStages, pushStage, "Creating PR..."];
|
||||
}
|
||||
|
||||
export function summarizeGitResult(result: GitRunStackedActionResult): {
|
||||
|
||||
@@ -226,11 +226,13 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp
|
||||
if (!confirmed) return;
|
||||
onConfirmed?.();
|
||||
|
||||
const pushTarget = gitStatus?.branch ? `origin/${gitStatus.branch}` : undefined;
|
||||
const progressStages = buildGitActionProgressStages({
|
||||
action,
|
||||
hasCustomCommitMessage: !!commitMessage?.trim(),
|
||||
hasWorkingTreeChanges: !!gitStatus?.hasWorkingTreeChanges,
|
||||
forcePushOnly: forcePushOnlyProgress,
|
||||
pushTarget,
|
||||
});
|
||||
const progressToastId = toastManager.add({
|
||||
type: "loading",
|
||||
|
||||
Reference in new issue
Block a user