Skip to content

Commit

Permalink
Save to disk only if contents changed
Browse files Browse the repository at this point in the history
Summary: I broke this behavior in the stdin diff, now fixing.

Reviewed By: zertosh

Differential Revision: D33978662

fbshipit-source-id: db2be12bdda868c8ea6e2802b7a561fe04e9eaa1
  • Loading branch information
cgrushko authored and facebook-github-bot committed Feb 3, 2022
1 parent 05508d7 commit a2ed7c9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/src/main/java/com/facebook/ktfmt/cli/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ class Main(
out.println(fileName)
}
} else {
file.writeText(formattedCode)
// TODO(T111284144): Add tests
if (!alreadyFormatted) {
file.writeText(formattedCode)
}
err.println("Done formatting $fileName")
}

Expand Down

0 comments on commit a2ed7c9

Please sign in to comment.