mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-15 18:11:48 +04:00
Add freeze config option for autoupdate command
This commit adds a new 'freeze' option to the CONFIG_SCHEMA, allowing users to set 'freeze: true' in their pre-commit configuration file. The intend are two effects, when setting `freeze: True`: * Enables freeze automatically when running `pre-commit autoupdate` (no need then anymore to specify --freeze). * Enables https://pre-commit.ci/ to freeze hooks as part of update PRs.
This commit is contained in:
parent
aa48766b88
commit
7c81f11d63
3 changed files with 15 additions and 0 deletions
|
|
@ -139,6 +139,17 @@ def test_rev_info_update_does_not_freeze_if_already_sha(out_of_date):
|
|||
assert new_info.frozen is None
|
||||
|
||||
|
||||
def test_autoupdate_freeze_from_config(tagged, tmpdir):
|
||||
git_commit(cwd=tagged.path)
|
||||
repo = make_config_from_repo(tagged.path, rev=tagged.original_rev)
|
||||
contents = {'repos': [repo], 'freeze': True}
|
||||
cfg = tmpdir.join(C.CONFIG_FILE)
|
||||
write_config(str(tmpdir), contents)
|
||||
|
||||
assert autoupdate(str(cfg), freeze=False, tags_only=True) == 0
|
||||
assert f'rev: {tagged.head_rev} # frozen: v1.2.3' in cfg.read()
|
||||
|
||||
|
||||
def test_autoupdate_up_to_date_repo(up_to_date, tmpdir):
|
||||
contents = (
|
||||
f'repos:\n'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue