Check for protected files in single apply diff (#5348)

This commit is contained in:
Matt Rubens 2025-07-02 13:52:13 -04:00 committed by GitHub
parent 3993406ebd
commit 1be6fce1a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -147,9 +147,13 @@ export async function applyDiffToolLegacy(
await cline.diffViewProvider.update(diffResult.content, true)
await cline.diffViewProvider.scrollToFirstDiff()
// Check if file is write-protected
const isWriteProtected = cline.rooProtectedController?.isWriteProtected(relPath) || false
const completeMessage = JSON.stringify({
...sharedMessageProps,
diff: diffContent,
isProtected: isWriteProtected,
} satisfies ClineSayTool)
let toolProgressStatus
@ -158,7 +162,7 @@ export async function applyDiffToolLegacy(
toolProgressStatus = cline.diffStrategy.getProgressStatus(block, diffResult)
}
const didApprove = await askApproval("tool", completeMessage, toolProgressStatus)
const didApprove = await askApproval("tool", completeMessage, toolProgressStatus, isWriteProtected)
if (!didApprove) {
await cline.diffViewProvider.revertChanges() // Cline likely handles closing the diff view