Skip to content
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

fix(tests): ignore no-op checkouts in some tests #1420

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions git-branchless/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ git-branchless-smartlog = { workspace = true }
git-branchless-submit = { workspace = true }
git-branchless-test = { workspace = true }
git-branchless-undo = { workspace = true }
insta = { workspace = true, features = ["filters"] }
itertools = { workspace = true }
lazy_static = { workspace = true }
lib = { workspace = true }
Expand Down
23 changes: 15 additions & 8 deletions git-branchless/tests/test_amend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,20 +592,26 @@ fn test_amend_undo() -> eyre::Result<()> {
{
let (stdout, _stderr) = git.branchless("undo", &["-y"])?;
let stdout = trim_lines(stdout);
insta::with_settings!({filters => vec![
// ignore no-op checkouts, which is present in e.g. git 2.43
// but disappears in e.g. git 2.46
(r"\n2\. Check out from 94b1077 create file1.txt\s*to 94b1077 create file1.txt\n", "\n"),
// ignore different numbering of events
(r"(?m)^[0-9]+\. ", "#. "),
("Applied ([0-9]+) inverse events.", "Applied # inverse events."),
]}, {
insta::assert_snapshot!(stdout, @r###"
Will apply these actions:
1. Move branch foo from 94b1077 create file1.txt
#. Move branch foo from 94b1077 create file1.txt
to 94b1077 create file1.txt
2. Check out from 94b1077 create file1.txt
to 94b1077 create file1.txt
3. Restore snapshot for branch foo
#. Restore snapshot for branch foo
pointing to 94b1077 create file1.txt
backed up using b4371f8 branchless: automated working copy snapshot
4. Move branch foo from 94b1077 create file1.txt
#. Move branch foo from 94b1077 create file1.txt
to c0bdfb5 create file1.txt
5. Rewrite commit 94b1077 create file1.txt
#. Rewrite commit 94b1077 create file1.txt
as c0bdfb5 create file1.txt
6. Restore snapshot for branch foo
#. Restore snapshot for branch foo
pointing to c0bdfb5 create file1.txt
backed up using a293e0b branchless: automated working copy snapshot
branchless: running command: <git-executable> checkout a293e0b4502882ced673f83b6742539ee06cbc74 -B foo
Expand All @@ -620,8 +626,9 @@ fn test_amend_undo() -> eyre::Result<()> {
O f777ecc (master) create initial.txt
|
@ c0bdfb5 (> foo) create file1.txt
Applied 6 inverse events.
Applied # inverse events.
"###);
});
}

{
Expand Down
Loading