mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-01-14 04:50:20 -06:00
Update migrate_config.py
Corrected loop condition to not run if configuration file only contains new lines.
This commit is contained in:
@@ -22,9 +22,8 @@ def _migrate_map(contents):
|
||||
lines = contents.splitlines(True)
|
||||
i = 0
|
||||
# Only loop on non empty configuration file
|
||||
if i < len(lines):
|
||||
while _is_header_line(lines[i]):
|
||||
i += 1
|
||||
while i < len(lines) and _is_header_line(lines[i]):
|
||||
i += 1
|
||||
|
||||
header = ''.join(lines[:i])
|
||||
rest = ''.join(lines[i:])
|
||||
|
||||
Reference in New Issue
Block a user