fix(tests): ignore no-op checkouts in some tests#1420
Conversation
| 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."), | ||
| ]}, { |
There was a problem hiding this comment.
This is interesting! I didn't know about insta filters. So the idea for these no-op checkouts is that they were introduced into git and then quickly-but-not-quickly-enough removed again?
FYI I also see some of these no-op checkout messages in test_undo_garbage_collected_commit.
There was a problem hiding this comment.
Yeah I think so! Back then I discovered insta's filter feature and was trying to fix some trivial test failures for newer versions of git, but it was a bit tedious so I didn't finish 🤣 Day job has now caught up with me so I will have to rebase and fix stuff next weekend, but feel free to take the ideas here and reuse them!
There was a problem hiding this comment.
FYI I also see some of these no-op checkout messages in
test_undo_garbage_collected_commit.
These no-op checkouts seem to persist as of git v2.51.2, and I have no idea what is happening haha...
|
Testing on git v2.51.2 it seems that there are still numerous test failures that I do not understand. The most frequents ones are similar to the following: ---- test_sync_basic stdout ----
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Snapshot Summary ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Snapshot: sync_basic-2
Source: git-branchless/tests/test_sync.rs:47
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Expression: stderr
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
-old snapshot
+new results
────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────
0 0 │ branchless: creating working copy snapshot
1 │+branchless: processing 1 update: ref HEAD
1 2 │ Switched to branch 'master'
2 3 │ branchless: processing checkout
3 4 │ branchless: creating working copy snapshot
5 │+branchless: processing 1 update: ref HEAD
4 6 │ Switched to branch 'master'
5 7 │ branchless: processing checkout
────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────I guess this one is harmless but I don't actually understand it... |
The patch makes use of insta's `filters` feature.
This makes use of insta's
filtersfeature.