mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Update migrate_config.py
Corrected loop condition to not run if configuration file only contains new lines.
This commit is contained in:
parent
7b491c7110
commit
f2be2ead35
1 changed files with 2 additions and 3 deletions
|
|
@ -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:])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue