ref: explain relative path behavior for all config values
In the docs for config we specifically note that for cache.dir
A correct value is either an absolute path, or a path relative to the config file location. The default value is cache, that resolves to .dvc/cache (relative to the project config file location).
It's unclear that:
- This relpath behavior actually applies to all config entries that take paths - including remote options like
credentialpath. (We don't mention this anywhere on any of the remote docs pages, and all of the examples on the remote pages only use absolute paths) - Paths manually written to the actual config file should be relative to the config directory (this also means
--globaland--systempaths should be relative to the global/system config directory and not relative to.dvc/) - Paths specified on the command line via
dvc config .../dvc remote modify ...should still be relative to the users current working directory
DVC automatically does the adjustment to convert whatever path specified ends up relative to the config directory like so:
$ dvc config cache.dir relative-dir
$ cat .dvc/config
[cache]
dir = ../relative-dir
$ dvc config cache.dir ../relative-dir
$ cat .dvc/config
[cache]
dir = ../../relative-dir
$ dvc config --global cache.dir ./relative-dir
$ cat ~/Library/Application\ Support/dvc/config
[cache]
dir = ../../../git/example-get-started/relative-dir
discord context: https://discord.com/channels/485586884165107732/485596304961962003/841840114585698314
It's unclear that: ... 2. Paths manually written to the actual config file should be relative to the config directory (this also means --global and --system
I think that "A correct value is ... a path relative to the config file location" covers that. We should probably emphasize that can mean system/global though.
- Paths specified on the command line ... should still be relative to the users current working directory
Wait, so is the info in cache.dir wrong? I.e. the default value couldn't be just cache (that would be converted to ../cache in .dvc/config
DVC automatically does the adjustment to convert whatever path specified ends up relative to the config directory
So is dvc cache dir basically no longer needed?
Need to try this ⌛
Wait, so is the info in cache.dir wrong? I.e. the default value couldn't be just cache
Yup
$ dvc config cache.dir cache
$ cat .dvc/config
[cache]
dir = ../cache
is dvc cache dir basically no longer needed?
I tried it and it seems so. It has the exact same result as dvc config cache.dir. When did this change? 🤷
I opened https://github.com/iterative/dvc/issues/6003
@pmrowla feel free to chime in https://github.com/iterative/dvc/issues/6003 to try and move this along. Thanks