Skip to content

Commit 1be6fce

Browse files
authored
Check for protected files in single apply diff (#5348)
1 parent 3993406 commit 1be6fce

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/core/tools/applyDiffTool.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,13 @@ export async function applyDiffToolLegacy(
147147
await cline.diffViewProvider.update(diffResult.content, true)
148148
await cline.diffViewProvider.scrollToFirstDiff()
149149

150+
// Check if file is write-protected
151+
const isWriteProtected = cline.rooProtectedController?.isWriteProtected(relPath) || false
152+
150153
const completeMessage = JSON.stringify({
151154
...sharedMessageProps,
152155
diff: diffContent,
156+
isProtected: isWriteProtected,
153157
} satisfies ClineSayTool)
154158

155159
let toolProgressStatus
@@ -158,7 +162,7 @@ export async function applyDiffToolLegacy(
158162
toolProgressStatus = cline.diffStrategy.getProgressStatus(block, diffResult)
159163
}
160164

161-
const didApprove = await askApproval("tool", completeMessage, toolProgressStatus)
165+
const didApprove = await askApproval("tool", completeMessage, toolProgressStatus, isWriteProtected)
162166

163167
if (!didApprove) {
164168
await cline.diffViewProvider.revertChanges() // Cline likely handles closing the diff view

0 commit comments

Comments
 (0)