Skip to content

Commit 0423a4b

Browse files
committed
fix: Do not generate text diff if not needed
1 parent aab3441 commit 0423a4b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/cli.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ function checkContents (file, source, parsed) {
220220
const { createTwoFilesPatch, structuredPatch } = require('diff')
221221
const structured = structuredPatch(`${file}.orig`, file, source, parsed, '', '', { context: 3 })
222222
const length = structured.hunks && structured.hunks.length
223-
const diff = createTwoFilesPatch(`${file}.orig`, file, source, parsed, '', '', { context: 3 })
224223
if (length > 0) {
225224
const hunk = length === 1 ? 'hunk differs' : 'hunks differ'
226225
const message = `${length} ${hunk}`
@@ -232,6 +231,7 @@ function checkContents (file, source, parsed) {
232231
console.error(message)
233232
}
234233
if (!options.quiet) {
234+
const diff = createTwoFilesPatch(`${file}.orig`, file, source, parsed, '', '', { context: 3 })
235235
console.log(diff)
236236
}
237237
if (options.continue) {

0 commit comments

Comments
 (0)