mirror of
https://github.com/martinvonz/jj.git
synced 2024-11-10 14:16:24 +03:00
cli: allow overriding ui.editor
config by $JJ_EDITOR
variable
This commit is contained in:
parent
96d559a4b4
commit
d6d2b8b5bc
@ -20,7 +20,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
does, all files in the directory will be read, in alphabetical order.
|
||||
|
||||
* You can now override the `$EDITOR` environment variable by setting the
|
||||
`ui.editor` config.
|
||||
`ui.editor` config. There is also a new `$JJ_EDITOR` environment variable,
|
||||
which has even higher priority than the config.
|
||||
|
||||
### Fixed bugs
|
||||
|
||||
|
@ -52,6 +52,9 @@ fn env_overrides() -> config::Config {
|
||||
if let Ok(value) = env::var("JJ_TIMESTAMP") {
|
||||
builder = builder.set_override("user.timestamp", value).unwrap();
|
||||
}
|
||||
if let Ok(value) = env::var("JJ_EDITOR") {
|
||||
builder = builder.set_override("ui.editor", value).unwrap();
|
||||
}
|
||||
builder.build().unwrap()
|
||||
}
|
||||
|
||||
|
@ -77,4 +77,12 @@ fn test_describe() {
|
||||
.assert()
|
||||
.failure();
|
||||
assert!(get_stderr_string(&assert).contains("bad-editor-from-config"));
|
||||
|
||||
// `$JJ_EDITOR` overrides `ui.editor` config
|
||||
let assert = test_env
|
||||
.jj_cmd(&repo_path, &["describe"])
|
||||
.env("JJ_EDITOR", "bad-jj-editor-from-env")
|
||||
.assert()
|
||||
.failure();
|
||||
assert!(get_stderr_string(&assert).contains("bad-jj-editor-from-env"));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user