Skip to content

Commit 05ffbce

Browse files
cursoragentTwixes
authored andcommitted
fix: remove unused import and non-null assertions
1 parent 2c57556 commit 05ffbce

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

apps/code/src/main/services/git/create-pr-saga.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,21 @@ export class CreatePrSaga extends Saga<CreatePrSagaInput, CreatePrSagaOutput> {
7272
let { commitMessage, prTitle, prBody } = input;
7373

7474
if (input.branchName) {
75+
const branchName = input.branchName;
7576
const currentBranch = await this.readOnlyStep("get-original-branch", () =>
7677
this.deps.getCurrentBranch(directoryPath),
7778
);
7879

7980
// on retry, do not attempt to re-create the branch
80-
if (currentBranch !== input.branchName) {
81+
if (currentBranch !== branchName) {
8182
this.deps.onProgress(
8283
"creating-branch",
83-
`Creating branch ${input.branchName}...`,
84+
`Creating branch ${branchName}...`,
8485
);
8586

8687
await this.step({
8788
name: "creating-branch",
88-
execute: () =>
89-
this.deps.createBranch(directoryPath, input.branchName!),
89+
execute: () => this.deps.createBranch(directoryPath, branchName),
9090
rollback: async () => {
9191
if (currentBranch) {
9292
await this.deps.checkoutBranch(directoryPath, currentBranch);
@@ -120,6 +120,8 @@ export class CreatePrSaga extends Saga<CreatePrSagaInput, CreatePrSagaOutput> {
120120
throw new Error("Commit message is required.");
121121
}
122122

123+
const finalCommitMessage = commitMessage;
124+
123125
this.deps.onProgress("committing", "Committing changes...");
124126

125127
const preCommitSha = await this.readOnlyStep("get-pre-commit-sha", () =>
@@ -129,10 +131,14 @@ export class CreatePrSaga extends Saga<CreatePrSagaInput, CreatePrSagaOutput> {
129131
await this.step({
130132
name: "committing",
131133
execute: async () => {
132-
const result = await this.deps.commit(directoryPath, commitMessage!, {
133-
stagedOnly: input.stagedOnly,
134-
taskId: input.taskId,
135-
});
134+
const result = await this.deps.commit(
135+
directoryPath,
136+
finalCommitMessage,
137+
{
138+
stagedOnly: input.stagedOnly,
139+
taskId: input.taskId,
140+
},
141+
);
136142
if (!result.success) throw new Error(result.message);
137143
return result;
138144
},

0 commit comments

Comments
 (0)