ok/jj
1
0
Fork 0
forked from mirrors/jj

cli: make default log revset work without working-copy commit

Spotted while adding an error propagation path from IdPrefixContext.
This commit is contained in:
Yuya Nishihara 2024-09-30 20:01:39 +09:00
parent 1f5835c267
commit 0a8d8dad67
4 changed files with 17 additions and 3 deletions

View file

@ -389,7 +389,7 @@
"log": {
"type": "string",
"description": "Default set of revisions to show when no explicit revset is given for jj log and similar commands",
"default": "@ | ancestors(immutable_heads().., 2) | trunk()"
"default": "present(@) | ancestors(immutable_heads().., 2) | trunk()"
},
"short-prefixes": {
"type": "string",

View file

@ -3,7 +3,7 @@
[revsets]
fix = "reachable(@, mutable())"
log = "@ | ancestors(immutable_heads().., 2) | trunk()"
log = "present(@) | ancestors(immutable_heads().., 2) | trunk()"
[revset-aliases]
'trunk()' = '''

View file

@ -217,6 +217,19 @@ fn test_log_default() {
"#);
}
#[test]
fn test_log_default_without_working_copy() {
let test_env = TestEnvironment::default();
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
let repo_path = test_env.env_root().join("repo");
test_env.jj_cmd_ok(&repo_path, &["workspace", "forget"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["log"]);
insta::assert_snapshot!(stdout, @r#"
zzzzzzzz root() 00000000
"#);
}
#[test]
fn test_log_builtin_templates() {
let test_env = TestEnvironment::default();

View file

@ -289,7 +289,8 @@ You can configure the revisions `jj log` would show when neither `-r` nor any pa
revsets.log = "main@origin.."
```
The default value for `revsets.log` is `'@ | ancestors(immutable_heads().., 2) | trunk()'`.
The default value for `revsets.log` is
`'present(@) | ancestors(immutable_heads().., 2) | trunk()'`.
### Graph style