-
Notifications
You must be signed in to change notification settings - Fork 395
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
FR: Per-repo jj configuration #3684
Comments
jj supports layaring configuration files. See Configuration. What's missing there is --system configuration loaded from something like $(prefix)/etc/jj/config or appropriate for the system for setting e.g. employer/company wide settings, but I suppose it could be solved by company specific distribution of jj |
Perhaps, the requested feature is "version-controlled" config file? Something like FWIW, there are security concerns about the current |
Yes, the primary purpose of this FR was for version controlled configuration files (I wasnt aware of the .jj/repo/config.toml, so I tried to add in that too, but the primary focus since that seemed trivial). |
If we go the way of a versioned config in a workspace, I would really prefer it to be in |
I much prefer your .config/JJ/config.toml over the example I had. I didn't really like my suggested placement but didn't have a better place to put it. |
So, there needs to be project-wide config (like for hooks), but these can be changed in the life of the project. |
Yep
I think there are three use cases of user config per project:
I think we have very little existing use cases to base this off. Version control configuration checked into version control is a relatively novel approach, AFAIK, but jj also has novel concepts which make this more useful.
I think that while that may be a problem, it's mostly unrelated to the config file. I think that in general, hooks are unlikely to change, since hooks should be an alias for what a user might run. If I were to suddenly change the version of rust I require, then my config file would still write "cargo", not "cargo-1.2.3". Similarly, users are generally not expected to add I think in general, this problem is solved by appropriate tooling elsewhere. This is simply a general problem of hermeticity, and I think it's outside of the scope of jj. For example, in bazel we use a |
One of the main problems with version control config in version control is that it can affect the behavior of operations potentially outside of the commit that contains the configuration. For example, The most common example is that a working copy commit may start tracking a given file, and then you may update the I don't recall where the original discussion was, but I think somebody investigated a case for |
You raise some very good points here, but I believe they should be addressed by this part of my proposal. I'm not proposing that the source of truth be stored in version control (for security reasons, but it happens to address your issues too)
|
Is your feature request related to a problem? Please describe.
I believe that there are 4 different types of configuration that may be useful for jj:
~/.config/jj/config.toml
)Sometimes it's quite handy to be able to have per-repo configuration. For example:
immutable_heads()
)jj fix
andjj lint
in the futureDescribe the solution you'd like
jj
already supports layering of configuration via the--config-toml
argument.This is very similar to bazel's
.bazelrc
files, which support workspace, user, and user-specified rc files (and most workspaces havetry-import %workspace%/user.bazelrc
at the bottom of their files, so for all intents and purposes, that's supported too).If it weren't for security concerns, I'd think we should adopt that model in an instant, but since bazel isn't worried about arbitrary code execution (that's literally it's job), we unfortunately have to go further. This is very similar to git hooks and their security model, so I propose the following changes.
<repo>/.jj/repo/repo_config.toml
<repo>/.jj/repo/user_config.toml
(path open for discussion)However, to deal with security concerns, we print a warning and ignore the file if either file is tracked by jj. This will prevent someone upstream sending you a file and allowing arbitrary code execution.
The next change we make is very simple. When
jj
starts, we read<repo>/jj/config.toml
(path open for discussion), and, if the file doesn't match<repo>/.jj/repo/repo_config.toml
, we print a warning that there is a more up to date configuration, and instruct them to run a commandjj install-config
or similar.jj install-config
would print a diff, warn them about the security concerns, and ask the user if they want to install the config to the repo (copying the file to<repo>/.jj/repo/repo_config.toml
).Describe alternatives you've considered
We could potentially instead put repo-specific conifguration as its own data format, but I think this is much more flexible and easy to use
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: