mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-19 17:14:43 +04:00
Merge pull request #661 from KevinHock/master
[Fix] Add existing repo_config to output_repos
This commit is contained in:
commit
bb2ced7b7f
2 changed files with 11 additions and 7 deletions
|
|
@ -116,11 +116,12 @@ def autoupdate(runner, tags_only, repo=None):
|
||||||
input_config = load_config(runner.config_file_path)
|
input_config = load_config(runner.config_file_path)
|
||||||
|
|
||||||
for repo_config in input_config['repos']:
|
for repo_config in input_config['repos']:
|
||||||
# Skip any repo_configs that aren't the specified repo
|
if (
|
||||||
if repo and repo != repo_config['repo']:
|
is_local_repo(repo_config) or
|
||||||
continue
|
is_meta_repo(repo_config) or
|
||||||
|
# Skip updating any repo_configs that aren't for the specified repo
|
||||||
if is_local_repo(repo_config) or is_meta_repo(repo_config):
|
repo and repo != repo_config['repo']
|
||||||
|
):
|
||||||
output_repos.append(repo_config)
|
output_repos.append(repo_config)
|
||||||
continue
|
continue
|
||||||
output.write('Updating {}...'.format(repo_config['repo']))
|
output.write('Updating {}...'.format(repo_config['repo']))
|
||||||
|
|
|
||||||
|
|
@ -127,10 +127,12 @@ def test_autoupdate_out_of_date_repo(
|
||||||
def test_autoupdate_out_of_date_repo_with_correct_repo_name(
|
def test_autoupdate_out_of_date_repo_with_correct_repo_name(
|
||||||
out_of_date_repo, in_tmpdir, mock_out_store_directory,
|
out_of_date_repo, in_tmpdir, mock_out_store_directory,
|
||||||
):
|
):
|
||||||
# Write out the config
|
stale_config = make_config_from_repo(
|
||||||
config = make_config_from_repo(
|
|
||||||
out_of_date_repo.path, sha=out_of_date_repo.original_sha, check=False,
|
out_of_date_repo.path, sha=out_of_date_repo.original_sha, check=False,
|
||||||
)
|
)
|
||||||
|
local_config = config_with_local_hooks()
|
||||||
|
config = {'repos': [stale_config, local_config]}
|
||||||
|
# Write out the config
|
||||||
write_config('.', config)
|
write_config('.', config)
|
||||||
|
|
||||||
runner = Runner('.', C.CONFIG_FILE)
|
runner = Runner('.', C.CONFIG_FILE)
|
||||||
|
|
@ -141,6 +143,7 @@ def test_autoupdate_out_of_date_repo_with_correct_repo_name(
|
||||||
assert ret == 0
|
assert ret == 0
|
||||||
assert before != after
|
assert before != after
|
||||||
assert out_of_date_repo.head_sha in after
|
assert out_of_date_repo.head_sha in after
|
||||||
|
assert local_config['repo'] in after
|
||||||
|
|
||||||
|
|
||||||
def test_autoupdate_out_of_date_repo_with_wrong_repo_name(
|
def test_autoupdate_out_of_date_repo_with_wrong_repo_name(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue