-
Notifications
You must be signed in to change notification settings - Fork 343
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
Add workspace config #3670
base: main
Are you sure you want to change the base?
Add workspace config #3670
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.
You missed to cargo +nightly fmt
the code and a additional test for the workspace level feature. If you fix that LGTM.
9737caa
to
01b8970
Compare
@@ -59,7 +60,7 @@ pub struct AnnotatedValue { | |||
/// 2. Base environment variables | |||
/// 3. [User config](https://github.com/martinvonz/jj/blob/main/docs/config.md#configuration) | |||
/// 4. Repo config `.jj/repo/config.toml` | |||
/// 5. TODO: Workspace config `.jj/config.toml` | |||
/// 5. Workspace config `.jj/config.toml` |
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.
I'm wondering whether .jj/working_copy/config.toml
might be a better location for this. Otherwise, this emphasizes the working-copy config over the repo-level config, and I'm not sure that's desired (people might assume this is the ONLY config file, and that it's therefore repo-level).
@yuja , @martinvonz , WDYT?
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.
I'm wondering whether
.jj/working_copy/config.toml
might be a better location for this.
My feeling is that .jj/working_copy
is the store directory dedicated for the WorkingCopy
implementation, so better to not add arbitrary files in it.
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.
OK.
I suppose, if need be, we could later move .jj/working_copy
to .jj/workspace/working_copy
and then .jj/config.toml
to .jj/workspace/config.toml
.
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.
I still find myself a little worried about people thinking that workspaces are broken if they end up using .jj/config.toml
instead of .jj/repo/config.toml
.
WDYT of putting this file in .jj/workspace/config.toml
now, and then moving working_copy
to that dir later?
This is made better by jj config edit
and jj config path
existing, so I don't think it's absolutely critical, but it would be nice to not have to move the config file later (with all the doc changes and backwards compatibility work that involves)
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.
Maybe the file can be renamed to .jj/workspace-config.toml
, then?
BTW, do we have any practical use case of workspace-specific configuration? If we don't, and if the existence of .jj/config.toml
is confusing, it might be better to not support workspace config at all. Not having workspace config might help simplify IncludeIf
-like conditional. #616
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.
I was thinking that the config for not ignoring the executable bit in the working copy (#4478) could be stored in a workspace-level config
Yes, but I assumed it's practically okay to set it to repo/config.toml. (Maybe I should say "immediate need", not "real use case".)
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.
If we go in the direction of supporting "IncludeIf" and conditional config, it might make sense to put workspace config inside repo config under a key like [if.workspace.default]
(assuming if.something
is how other conditional config can be setup; I'd want these to have similar syntax if possible, thought it's not absolutely necessary).
For something like executable bits, we could eventually have a fancier conditionals like "Config for all workspaces under /mnt/c
" (or whatever the WSL mount for the NTFS C: drive is).
At the same time, I'm not sure whether the conditional config idea is more practical for now (or in general). It might be easier to have workspace-config.toml
for now (or even permanently).
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.
For context, the reason I went ahead and implemented the workspace config is because I had a complex repository scenario where multiple related-but-divergent trunks shared a lot of history, and wanted to use multiple workspaces to manage the different related codebases with different jj templates and revsets for each.
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.
Ok, if there's a real need, we shouldn't be too nitpicky. Let's land .jj/config.toml
or .jj/workspace-config.toml
. I think @ilyagr is okay with .jj/workspace-config.toml
.
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.
I'm OK with .jj/workspace-config.toml
. I appreciate Eidolon explaining one more use-case; I don't have a clear opinion on what the conclusion from that or from Martin's use-case should be.
@@ -59,7 +60,7 @@ pub struct AnnotatedValue { | |||
/// 2. Base environment variables | |||
/// 3. [User config](https://github.com/martinvonz/jj/blob/main/docs/config.md#configuration) | |||
/// 4. Repo config `.jj/repo/config.toml` | |||
/// 5. TODO: Workspace config `.jj/config.toml` | |||
/// 5. Workspace config `.jj/config.toml` |
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.
I'm wondering whether
.jj/working_copy/config.toml
might be a better location for this.
My feeling is that .jj/working_copy
is the store directory dedicated for the WorkingCopy
implementation, so better to not add arbitrary files in it.
01b8970
to
24450f6
Compare
Just FYI, you had a flaky test failure, I re-ran the testing job for you. You should be able to re-run it as well, I think, in the Actions tab. |
@HybridEidolon Any intent to land this soon? It probably just needs a rebase and solving the conflict in CHANGELOG.md. |
Yep, I can look at this again after I return from my trip next week. |
e0c65f5
to
9bcbe94
Compare
Rebased on upstream with conflicts resolved |
This adds support for per-workspace configuration as was described as a TODO in the LayeredConfig struct. Like repo configuration in `.jj/repo/config.toml`, the workspace config goes in `.jj/config.toml` in the workspace root, and its settings take precedence over repo, user and default configs. The config subcommands that take `--user` and `--repo` are additionally given `--workspace` which behaves as one would expect.
9bcbe94
to
0f7ff5b
Compare
This adds support for per-workspace configuration as was described as a TODO in the LayeredConfig struct. Like repo configuration in
.jj/repo/config.toml
, the workspace config goes in.jj/config.toml
in the workspace root, and its settings take precedence over repo, user and default configs.The config subcommands that take
--user
and--repo
are additionally given--workspace
which behaves as one would expect.Checklist
If applicable:
CHANGELOG.md