diff --git a/dvc/command/config.py b/dvc/command/config.py index 890c562404..b49dac8243 100644 --- a/dvc/command/config.py +++ b/dvc/command/config.py @@ -48,6 +48,13 @@ def _check(self, conf, section, opt=None): msg = "option {} doesn't exist" raise ConfigError(msg.format(self.args.name)) + if self.args.name == "core.no_scm" and self.args.level in [ + "global", + "system", + ]: + msg = "{} not allowed on a {} level" + raise ConfigError(msg.format(self.args.name, self.args.level)) + parent_config_parser = argparse.ArgumentParser(add_help=False) parent_config_parser.add_argument( diff --git a/tests/func/test_config.py b/tests/func/test_config.py index 1ae0118b77..ca01fd979d 100644 --- a/tests/func/test_config.py +++ b/tests/func/test_config.py @@ -106,3 +106,10 @@ def test_merging_two_levels(dvc): def test_config_loads_without_error_for_non_dvc_repo(tmp_dir): # regression testing for https://github.com/iterative/dvc/issues/3328 Config(validate=True) + + +def test_no_scm(dvc): + assert 251 == main(["config", "--global", "core.no_scm", "true"]) + assert 251 == main(["config", "--system", "core.no_scm", "true"]) + assert 0 == main(["config", "--local", "core.no_scm", "true"]) + assert 0 == main(["config", "core.no_scm", "true"])