Skip to content

Commit ceaba68

Browse files
authored
config: temporarily forbid --show-origin without level (#5184)
1 parent 8162bb1 commit ceaba68

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

dvc/command/config.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ def run(self):
4343
"options: -u/--unset, value"
4444
)
4545
return 1
46+
if not self.args.level:
47+
logger.error(
48+
"--show-origin requires one of these options: "
49+
"--system, --global, --repo, --local"
50+
)
51+
return 1
4652

4753
if self.args.list:
4854
if any((self.args.name, self.args.value, self.args.unset)):

tests/func/test_config.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,14 +261,16 @@ def test_config_show_origin(tmp_dir, dvc, caplog):
261261
)
262262

263263
caplog.clear()
264-
assert main(["config", "--show-origin", "remote.myremote.url"]) == 0
264+
assert (
265+
main(["config", "--show-origin", "--repo", "remote.myremote.url"]) == 0
266+
)
265267
assert (
266268
"{}\t{}\n".format(os.path.join(".dvc", "config"), "s3://bucket/path")
267269
in caplog.text
268270
)
269271

270272
caplog.clear()
271-
assert main(["config", "--list", "--show-origin"]) == 0
273+
assert main(["config", "--list", "--repo", "--show-origin"]) == 0
272274
assert (
273275
"{}\t{}\n".format(
274276
os.path.join(".dvc", "config"),

0 commit comments

Comments
 (0)