diff --git a/pre_commit/commands/autoupdate.py b/pre_commit/commands/autoupdate.py index 844c6017..4dce674f 100644 --- a/pre_commit/commands/autoupdate.py +++ b/pre_commit/commands/autoupdate.py @@ -98,7 +98,7 @@ def _write_new_config_file(path, output): # If we failed to intelligently rewrite the sha lines, fall back to the # pretty-formatted yaml output to_write = ''.join(lines) - if ordered_load(to_write) != output: + if remove_defaults(ordered_load(to_write), CONFIG_SCHEMA) != output: to_write = new_contents with open(path, 'w') as f: diff --git a/tests/commands/autoupdate_test.py b/tests/commands/autoupdate_test.py index 7fb21b9d..2877c5b3 100644 --- a/tests/commands/autoupdate_test.py +++ b/tests/commands/autoupdate_test.py @@ -275,7 +275,7 @@ def test_autoupdate_local_hooks(tempdir_factory): runner = Runner(path, C.CONFIG_FILE) assert autoupdate(runner, tags_only=False) == 0 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