Skip to content

Commit a821172

Browse files
committed
Remove defaults before checking whether the intelligent rewrite was successful
1 parent 72e3989 commit a821172

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pre_commit/commands/autoupdate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def _write_new_config_file(path, output):
9898
# If we failed to intelligently rewrite the sha lines, fall back to the
9999
# pretty-formatted yaml output
100100
to_write = ''.join(lines)
101-
if ordered_load(to_write) != output:
101+
if remove_defaults(ordered_load(to_write), CONFIG_SCHEMA) != output:
102102
to_write = new_contents
103103

104104
with open(path, 'w') as f:

tests/commands/autoupdate_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def test_autoupdate_local_hooks(tempdir_factory):
275275
runner = Runner(path, C.CONFIG_FILE)
276276
assert autoupdate(runner, tags_only=False) == 0
277277
new_config_writen = load_config(runner.config_file_path)
278-
assert len(new_config_writen) == 1
278+
assert len(new_config_writen['repos']) == 1
279279
assert new_config_writen['repos'][0] == config
280280

281281

0 commit comments

Comments
 (0)