mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-15 08:53:16 +00:00
Test jj log
for divergent commits
It turns out we did not have tests that would catch `jj log` failing to mark divergent commits.
This commit is contained in:
parent
265fa7f7c7
commit
9974d67da2
1 changed files with 44 additions and 0 deletions
|
@ -288,6 +288,50 @@ fn test_log_with_or_without_diff() {
|
||||||
"###);
|
"###);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_log_divergence() {
|
||||||
|
let test_env = TestEnvironment::default();
|
||||||
|
test_env.jj_cmd_success(test_env.env_root(), &["init", "repo", "--git"]);
|
||||||
|
let repo_path = test_env.env_root().join("repo");
|
||||||
|
|
||||||
|
std::fs::write(repo_path.join("file"), "foo\n").unwrap();
|
||||||
|
test_env.jj_cmd_success(&repo_path, &["describe", "-m", "description 1"]);
|
||||||
|
let stdout = test_env.jj_cmd_success(
|
||||||
|
&repo_path,
|
||||||
|
&[
|
||||||
|
"log",
|
||||||
|
"-T",
|
||||||
|
r#"description.first_line() if(divergent, " !divergence!")"#,
|
||||||
|
],
|
||||||
|
);
|
||||||
|
// No divergence
|
||||||
|
insta::assert_snapshot!(stdout, @r###"
|
||||||
|
@ description 1
|
||||||
|
o (no description set)
|
||||||
|
"###);
|
||||||
|
|
||||||
|
// Create divergence
|
||||||
|
test_env.jj_cmd_success(
|
||||||
|
&repo_path,
|
||||||
|
&["describe", "-m", "description 2", "--at-operation", "@-"],
|
||||||
|
);
|
||||||
|
let stdout = test_env.jj_cmd_success(
|
||||||
|
&repo_path,
|
||||||
|
&[
|
||||||
|
"log",
|
||||||
|
"-T",
|
||||||
|
r#"description.first_line() if(divergent, " !divergence!")"#,
|
||||||
|
],
|
||||||
|
);
|
||||||
|
insta::assert_snapshot!(stdout, @r###"
|
||||||
|
Concurrent modification detected, resolving automatically.
|
||||||
|
o description 2 !divergence!
|
||||||
|
| @ description 1 !divergence!
|
||||||
|
|/
|
||||||
|
o (no description set)
|
||||||
|
"###);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_log_reversed() {
|
fn test_log_reversed() {
|
||||||
let test_env = TestEnvironment::default();
|
let test_env = TestEnvironment::default();
|
||||||
|
|
Loading…
Reference in a new issue