Skip to content

Commit

Permalink
test_git_colocated.rs: Adding another push to squash-push-undo test b…
Browse files Browse the repository at this point in the history
…reaks it

This change should not affect the test at all, but does.
  • Loading branch information
ilyagr committed Apr 6, 2023
1 parent 7165003 commit e75e6fa
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions tests/test_git_colocated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,11 @@ fn test_git_colocated_squash_undo() {
"###);
}

// This test is just like the above test but with a `jj git push` inserted
// This test is just like the above test but with a couple of `jj git push`
// inserted
//
// TODO: Fix the BUG it reveals. The bug may be related to `jj git push` not
// calling `jj git export` properly, or it may be a bug in `jj git export.
#[test]
fn test_git_colocated_squash_push_undo() {
let test_env = TestEnvironment::default();
Expand All @@ -309,6 +313,7 @@ fn test_git_colocated_squash_push_undo() {
test_env.jj_cmd_success(&repo_path, &["ci", "-m=A"]);
test_env.jj_cmd_success(&repo_path, &["describe", "-m=B"]);
test_env.jj_cmd_success(&repo_path, &["branch", "set", "master"]);
test_env.jj_cmd_success(&repo_path, &["git", "push", "--all"]);
// Test the setup
insta::assert_snapshot!(get_log_output_divergence(&test_env, &repo_path), @r###"
@ rlvkpnrzqnoo 2a3078eda7fe B master
Expand All @@ -318,35 +323,34 @@ fn test_git_colocated_squash_push_undo() {

test_env.jj_cmd_success(&repo_path, &["squash", "-m=A+B"]);
insta::assert_snapshot!(get_log_output_divergence(&test_env, &repo_path), @r###"
@ royxmykxtrkr 83c0d8df2b78
◉ qpvuntsmwlqt 1873a0811bf5 A+B master
@ yqosqzytrlsw 91096ede1b94
◉ qpvuntsmwlqt 3ca5eff09136 A+B master*
◉ zzzzzzzzzzzz 000000000000
"###);
test_env.jj_cmd_success(&repo_path, &["git", "push", "--all"]);
insta::assert_snapshot!(get_log_output_divergence(&test_env, &repo_path), @r###"
@ royxmykxtrkr 83c0d8df2b78
◉ qpvuntsmwlqt 1873a0811bf5 A+B master
@ yqosqzytrlsw 91096ede1b94
◉ qpvuntsmwlqt 3ca5eff09136 A+B master
◉ zzzzzzzzzzzz 000000000000
"###);
let stdout = get_truncated_op_log(&test_env, &repo_path, 9);
insta::assert_snapshot!(stdout, @r###"
@ 92f3965076e7 [email protected] 22 years ago, lasted less than a microsecond
@ e3ba083e16da [email protected] 22 years ago, lasted less than a microsecond
│ push all branches to git remote origin
│ args: jj git push --all
34f35f48e4eb [email protected] 22 years ago, lasted less than a microsecond
98b717fda32d [email protected] 22 years ago, lasted less than a microsecond
│ squash commit 2a3078eda7fe17eeb3cd3e390f7476dff078e35f
│ args: jj squash '-m=A+B'
dfdfe3eb8a2c [email protected] 22 years ago, lasted less than a microsecond
point branch master to commit 2a3078eda7fe17eeb3cd3e390f7476dff078e35f
│ args: jj branch set master
05b9c30f160f [email protected] 22 years ago, lasted less than a microsecond
push all branches to git remote origin
│ args: jj git push --all
"###);
// Restore to before the squash
test_env.jj_cmd_success(&repo_path, &["op", "restore", "@--"]);
// We expect `master` to be back at B while master@origin is at A+B. Here,
// master ends up conflicted. This is arguably wrong, but not too bad.
// BUG: `master` didn't get back to B
insta::assert_snapshot!(get_log_output_divergence(&test_env, &repo_path), @r###"
◉ qpvuntsmwlqt 1873a0811bf5 A+B master?? master@origin !divergence!
│ @ rlvkpnrzqnoo 2a3078eda7fe B master??
◉ qpvuntsmwlqt 3ca5eff09136 A+B master !divergence!
│ @ rlvkpnrzqnoo 2a3078eda7fe B
│ ◉ qpvuntsmwlqt a86754f975f9 A !divergence!
├─╯
◉ zzzzzzzzzzzz 000000000000
Expand Down

0 comments on commit e75e6fa

Please sign in to comment.