Skip to content

Commit

Permalink
Merge pull request #72 from jacobkoziej/fix/write-on-no-change
Browse files Browse the repository at this point in the history
Only write to disk if file contents changed
  • Loading branch information
pappasam authored Nov 16, 2024
2 parents 221f299 + f0f7934 commit c2be338
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions toml_sort/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,9 +442,11 @@ def cli( # pylint: disable=too-many-branches,too-many-locals
if original_toml != sorted_toml:
check_failures.append(filename)
elif args.in_place:
write_file(filename, sorted_toml)
if original_toml != sorted_toml:
write_file(filename, sorted_toml)
elif len(filenames_clean) == 1:
write_file(output_clean, sorted_toml)
if original_toml != sorted_toml:
write_file(output_clean, sorted_toml)
else:
printerr("Uncaught error. Please submit GitHub issue:")
printerr("<https://github.com/pappasam/toml-sort/issues>")
Expand Down

0 comments on commit c2be338

Please sign in to comment.