Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: add support for --show-origin #5119

Closed
efiop opened this issue Dec 16, 2020 · 4 comments · Fixed by #5126 or #5188
Closed

config: add support for --show-origin #5119

efiop opened this issue Dec 16, 2020 · 4 comments · Fixed by #5126 or #5188
Labels
feature request Requesting a new feature p2-medium Medium priority, should be done, but less important

Comments

@efiop
Copy link
Contributor

efiop commented Dec 16, 2020

Same as git config:

$ git config --list --show-origin
file:/home/efiop/.gitconfig     [email protected]
file:/home/efiop/.gitconfig     user.name=Ruslan Kuprieiev
file:.git/config        core.repositoryformatversion=0
file:.git/config        core.filemode=true
file:.git/config        core.bare=false
file:.git/config        core.logallrefupdates=true
file:.git/config        [email protected]:efiop/dvc
file:.git/config        remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
file:.git/config        branch.master.remote=origin
file:.git/config        branch.master.merge=refs/heads/master
file:.git/config        [email protected]:iterative/dvc
file:.git/config        remote.upstream.fetch=+refs/heads/*:refs/remotes/upstream/*
file:.git/config        branch.fix-4050.remote=origin
file:.git/config        branch.fix-4050.merge=refs/heads/fix-4050
file:.git/config        branch.fix-4162.remote=origin
file:.git/config        branch.fix-4162.merge=refs/heads/fix-4162

i'm not personally sold on file: prefix in path (just because I don't really know why git does that, maybe there is a good reason), but the rest looks pretty good. We now have dvc config --list, so now we need dvc config --list --show-origin as the next step.

This will be realy handy to have for users to figure out where the configs are and also handy for us, developers, when debugging particular issues.

@efiop efiop added the feature request Requesting a new feature label Dec 16, 2020
@shcheklein shcheklein added the p2-medium Medium priority, should be done, but less important label Dec 16, 2020
@mrstegeman
Copy link
Contributor

I'll pick this up and submit a PR soon.

mrstegeman added a commit to mrstegeman/dvc that referenced this issue Dec 17, 2020
Support the --show-origin option for config, which, similar to git,
prefixes each config option with the source file it originated from.

Fixes iterative#5119
mrstegeman added a commit to mrstegeman/dvc.org that referenced this issue Dec 17, 2020
Support the --show-origin option for config, which, similar to git,
prefixes each config option with the source file it originated from.

References iterative/dvc#5119
References iterative/dvc#5126
@pmrowla
Copy link
Contributor

pmrowla commented Dec 22, 2020

i'm not personally sold on file: prefix in path (just because I don't really know why git does that, maybe there is a good reason), but the rest looks pretty good. We now have dvc config --list, so now we need dvc config --list --show-origin as the next step.

For reference, it's because git config options can come from other sources - stdin, command line, or git blobs. I don't think we would ever have anything besides file in DVC though

@efiop
Copy link
Contributor Author

efiop commented Dec 22, 2020

@pmrowla Oh, didn't know that! Makes sense now. Thank you for clarifying! 🙏

efiop added a commit that referenced this issue Dec 30, 2020
* cli: config: add support for --show-origin

Support the --show-origin option for config, which, similar to git,
prefixes each config option with the source file it originated from.

Fixes #5119

* Reformat with black.

* Simplify logic for local config files.

* Add test for --show-config output.

* Update tests/func/test_config.py

Co-authored-by: Ruslan Kuprieiev <[email protected]>
@efiop
Copy link
Contributor Author

efiop commented Dec 30, 2020

Reopening to support it for a new correct dvc config behavior. #5184

@efiop efiop reopened this Dec 30, 2020
mrstegeman added a commit to mrstegeman/dvc that referenced this issue Dec 31, 2020
Builds on iterative#5126 and iterative#5184 by showing the full merged config when
listing or getting config options.

References iterative#5126
References iterative#5184
References iterative/dvc.org#2028
Fixes iterative#5119
mrstegeman added a commit to mrstegeman/dvc.org that referenced this issue Dec 31, 2020
Support the --show-origin option for config, which, similar to git,
prefixes each config option with the source file it originated from.

References iterative/dvc#5119
References iterative/dvc#5126
efiop added a commit that referenced this issue Jan 4, 2021
* cli: config: show merged config with --show-origin

Builds on #5126 and #5184 by showing the full merged config when
listing or getting config options.

References #5126
References #5184
References iterative/dvc.org#2028
Fixes #5119

* Add additional tests.

* Add test for merged config.

* config: rename methods

Co-authored-by: OLOLO ALALA <[email protected]>
shcheklein pushed a commit to iterative/dvc.org that referenced this issue Feb 4, 2021
* cli: config: add docs for --show-origin

Support the --show-origin option for config, which, similar to git,
prefixes each config option with the source file it originated from.

References iterative/dvc#5119
References iterative/dvc#5126

* Update wording.

* Add note about the options near config file locations.

* Update content/docs/command-reference/config.md

Co-authored-by: Jorge Orpinel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Requesting a new feature p2-medium Medium priority, should be done, but less important
Projects
None yet
4 participants