Skip to content

Commit bf384c5

Browse files
author
David Hasani
committed
always resume even on empty diff
1 parent 4552439 commit bf384c5

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

packages/core/src/codewhisperer/service/transformByQ/transformApiHandler.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -772,13 +772,7 @@ async function attemptLocalBuild() {
772772
getLogger().info(
773773
`CodeTransformation: downloaded clientInstructions with diff.patch at: ${clientInstructionsPath}`
774774
)
775-
const diffContents = await fs.readFileText(clientInstructionsPath)
776-
// make sure diff.patch is not empty
777-
if (diffContents.trim()) {
778-
await processClientInstructions(jobId, clientInstructionsPath, artifactId)
779-
} else {
780-
getLogger().info('CodeTransformation: diff.patch is empty, skipping client-side build for this iteration')
781-
}
775+
await processClientInstructions(jobId, clientInstructionsPath, artifactId)
782776
}
783777
}
784778

@@ -812,11 +806,18 @@ async function processClientInstructions(jobId: string, clientInstructionsPath:
812806
const destinationPath = path.join(os.tmpdir(), `originalCopy_${jobId}_${artifactId}`)
813807
await extractOriginalProjectSources(destinationPath)
814808
getLogger().info(`CodeTransformation: copied project to ${destinationPath}`)
815-
const diffModel = new DiffModel()
816-
diffModel.parseDiff(clientInstructionsPath, path.join(destinationPath, 'sources'), true)
817-
// show user the diff.patch
818-
const doc = await vscode.workspace.openTextDocument(clientInstructionsPath)
819-
await vscode.window.showTextDocument(doc, { viewColumn: vscode.ViewColumn.One })
809+
const diffContents = await fs.readFileText(clientInstructionsPath)
810+
if (diffContents.trim()) {
811+
const diffModel = new DiffModel()
812+
diffModel.parseDiff(clientInstructionsPath, path.join(destinationPath, 'sources'), true)
813+
// show user the diff.patch
814+
const doc = await vscode.workspace.openTextDocument(clientInstructionsPath)
815+
await vscode.window.showTextDocument(doc, { viewColumn: vscode.ViewColumn.One })
816+
} else {
817+
// still need to set the project copy so that we can use it below
818+
transformByQState.setProjectCopyFilePath(path.join(destinationPath, 'sources'))
819+
getLogger().info(`CodeTransformation: diff.patch is empty`)
820+
}
820821
await runClientSideBuild(transformByQState.getProjectCopyFilePath(), artifactId)
821822
}
822823

0 commit comments

Comments
 (0)