mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-15 01:51:46 +04:00
Remove defaults before checking whether the intelligent rewrite was successful
This commit is contained in:
parent
72e3989350
commit
a821172d9d
2 changed files with 2 additions and 2 deletions
|
|
@ -98,7 +98,7 @@ def _write_new_config_file(path, output):
|
||||||
# If we failed to intelligently rewrite the sha lines, fall back to the
|
# If we failed to intelligently rewrite the sha lines, fall back to the
|
||||||
# pretty-formatted yaml output
|
# pretty-formatted yaml output
|
||||||
to_write = ''.join(lines)
|
to_write = ''.join(lines)
|
||||||
if ordered_load(to_write) != output:
|
if remove_defaults(ordered_load(to_write), CONFIG_SCHEMA) != output:
|
||||||
to_write = new_contents
|
to_write = new_contents
|
||||||
|
|
||||||
with open(path, 'w') as f:
|
with open(path, 'w') as f:
|
||||||
|
|
|
||||||
|
|
@ -275,7 +275,7 @@ def test_autoupdate_local_hooks(tempdir_factory):
|
||||||
runner = Runner(path, C.CONFIG_FILE)
|
runner = Runner(path, C.CONFIG_FILE)
|
||||||
assert autoupdate(runner, tags_only=False) == 0
|
assert autoupdate(runner, tags_only=False) == 0
|
||||||
new_config_writen = load_config(runner.config_file_path)
|
new_config_writen = load_config(runner.config_file_path)
|
||||||
assert len(new_config_writen) == 1
|
assert len(new_config_writen['repos']) == 1
|
||||||
assert new_config_writen['repos'][0] == config
|
assert new_config_writen['repos'][0] == config
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue