-
Notifications
You must be signed in to change notification settings - Fork 355
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
cli: load configs from .jj/repo/config.toml #982
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Very useful feature, and very nicely done.
UserSettings will be instantiated after both user and repo configs are loaded. We might want to add a wrapper for CLI settings, but I have no idea how that should be structured. Let's use bare config::Config until then.
…nfig For the same reason as the previous commit. -R/--repository can't be parsed until the real command name gets available.
The next commit will add a struct that keeps umerged configs, which will be used to insert repo config between user and override configs.
Thinking of config precedence, we'll probably need to store "base" (default + env_base + user) config and "override" (env_overrides + --config-toml) config separately to support repo config. Suppose env_overrides() is a temporary value, it's better to override any file-derived values with $JJ_ env.
Since CliRunner knows both defaults and envs, it makes sense to feed them to initialize ui.
It's unclear whether parse_args() or its caller should update LayeredConfigs. --config-toml is processed by callee to apply --color early. -R/--repository will be processed by caller since it will instantiate WorkspaceLoader. Maybe --config-toml can be removed from EarlyArgs, and handle_early_args() just updates ui state based on --color argument?
Since per-repo config may contain CLI settings, it must be visible to CLI. Therefore, UserSettings::with_repo() -> RepoSettings isn't used, and its implementation is nullified by this commit. #616
Could you explain how precedence is expected to work? I'm running jj at its github HEAD, and I set a per-repo alias inside |
Example (let us know if that doesn't work for you): $ jj config list aliases.foo
aliases.foo=["st"]
$ cd $(mktemp -d); jj init --git
Initialized repo in "."
$ echo 'aliases.foo = ["diff"]' > .jj/repo/config.toml
$ jj config list aliases.foo
aliases.foo=["diff"] |
This is what I got:
|
This PR has been closed for a while, so I moved this to a new bug report instead: #2414 |
Checklist
If applicable:
CHANGELOG.md