Skip to content

Commit

Permalink
Fixed #1306: unexpected --diff behavior.
Browse files Browse the repository at this point in the history
  • Loading branch information
timothycrosley committed Jul 10, 2020
1 parent e0c6175 commit f16032d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions isort/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,9 @@ def sort_file(
file_output=tmp_file.read_text(encoding=source_file.encoding),
file_path=file_path or source_file.path,
)
if ask_to_apply and not ask_whether_to_apply_changes_to_file(
str(source_file.path)
if show_diff or (
ask_to_apply
and not ask_whether_to_apply_changes_to_file(str(source_file.path))
):
return
source_file.stream.close()
Expand Down

0 comments on commit f16032d

Please sign in to comment.