diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-10-16 11:18:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-10-16 11:18:13 +0000 |
commit | 535187ceaf88786aaf22560790564f1f6965ba30 (patch) | |
tree | 82456c5d0bc77961759812ddd85414435ba89127 /pre_commit_hooks/file_contents_sorter.py | |
parent | Adding upstream version 4.4.0+dfsg. (diff) | |
download | pre-commit-hooks-535187ceaf88786aaf22560790564f1f6965ba30.tar.xz pre-commit-hooks-535187ceaf88786aaf22560790564f1f6965ba30.zip |
Adding upstream version 4.5.0+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pre_commit_hooks/file_contents_sorter.py')
-rw-r--r-- | pre_commit_hooks/file_contents_sorter.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pre_commit_hooks/file_contents_sorter.py b/pre_commit_hooks/file_contents_sorter.py index c5691f0..02bdbcc 100644 --- a/pre_commit_hooks/file_contents_sorter.py +++ b/pre_commit_hooks/file_contents_sorter.py @@ -37,7 +37,10 @@ def sort_file_contents( after = sorted(lines, key=key) before_string = b''.join(before) - after_string = b'\n'.join(after) + b'\n' + after_string = b'\n'.join(after) + + if after_string: + after_string += b'\n' if before_string == after_string: return PASS |