Skip to content

Commit defdbb0

Browse files
authored
Merge pull request #10865 from Byron/fix
Fix workspace test concurrency
2 parents 8ebbc1d + 3715cd5 commit defdbb0

File tree

4 files changed

+44
-42
lines changed

4 files changed

+44
-42
lines changed

crates/but-workspace/tests/workspace/branch/apply_unapply_commit_uncommit.rs

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ fn no_ws_ref_no_ws_commit_two_stacks_on_same_commit_ad_hoc_workspace_without_tar
378378
)?;
379379
// A workspace commit was created, even though it does nothing.
380380
insta::assert_snapshot!(visualize_commit_graph_all(&repo)?, @r"
381-
* 5169839 (HEAD -> gitbutler/workspace) GitButler Workspace Commit
381+
* 6277161 (HEAD -> gitbutler/workspace) GitButler Workspace Commit
382382
* e5d0542 (origin/main, main, B, A) A
383383
");
384384

@@ -403,7 +403,7 @@ fn no_ws_ref_no_ws_commit_two_stacks_on_same_commit_ad_hoc_workspace_without_tar
403403

404404
// It's idempotent, but has to update the workspace commit nonetheless for the comment, which depends on the stacks.
405405
insta::assert_snapshot!(visualize_commit_graph_all(&repo)?, @r"
406-
* 4f21fe4 (HEAD -> gitbutler/workspace) GitButler Workspace Commit
406+
* 452772e (HEAD -> gitbutler/workspace) GitButler Workspace Commit
407407
|\
408408
* e5d0542 (origin/main, main, B, A) A
409409
");
@@ -615,12 +615,13 @@ fn detached_head_journey() -> anyhow::Result<()> {
615615
}
616616
"#);
617617
insta::assert_snapshot!(visualize_commit_graph_all(&repo)?, @r"
618-
* f2d8a20 (HEAD -> gitbutler/workspace) GitButler Workspace Commit
619-
|\
620-
| * f57c528 (B) B1
621-
* | aaa195b (C) C1
622-
|/
623-
| * 49d4b34 (A) A1
618+
* 49d4b34 (A) A1
619+
| * fdec130 (HEAD -> gitbutler/workspace) GitButler Workspace Commit
620+
| |\
621+
| | * f57c528 (B) B1
622+
| |/
623+
|/|
624+
| * aaa195b (C) C1
624625
|/
625626
* 3183e43 (main) M1
626627
");
@@ -672,7 +673,7 @@ fn detached_head_journey() -> anyhow::Result<()> {
672673
");
673674

674675
insta::assert_snapshot!(visualize_commit_graph_all(&repo)?, @r"
675-
*-. 40e102f (HEAD -> gitbutler/workspace) GitButler Workspace Commit
676+
*-. 951ff29 (HEAD -> gitbutler/workspace) GitButler Workspace Commit
676677
|\ \
677678
| | * f57c528 (B) B1
678679
| * | aaa195b (C) C1
@@ -745,7 +746,7 @@ fn apply_two_ambiguous_stacks_with_target_with_dependent_branch() -> anyhow::Res
745746
");
746747

747748
insta::assert_snapshot!(visualize_commit_graph_all(&repo)?, @r"
748-
* ef9bcae (HEAD -> gitbutler/workspace) GitButler Workspace Commit
749+
* 78f3659 (HEAD -> gitbutler/workspace) GitButler Workspace Commit
749750
|\
750751
| * f084d61 (C, B, A) A2
751752
|/
@@ -834,7 +835,7 @@ fn apply_two_ambiguous_stacks_with_target() -> anyhow::Result<()> {
834835
└── ·7076dee (🏘️) ►D, ►E
835836
");
836837
insta::assert_snapshot!(visualize_commit_graph_all(&repo)?, @r"
837-
* 8444317 (HEAD -> gitbutler/workspace) GitButler Workspace Commit
838+
* 773e030 (HEAD -> gitbutler/workspace) GitButler Workspace Commit
838839
* f084d61 (C, B, A) A2
839840
* 7076dee (E, D) A1
840841
* 85efbe4 (origin/main, main) M
@@ -863,7 +864,7 @@ fn apply_two_ambiguous_stacks_with_target() -> anyhow::Result<()> {
863864
└── ·7076dee (🏘️) ►D, ►E
864865
");
865866
insta::assert_snapshot!(visualize_commit_graph_all(&repo)?, @r"
866-
* 102321c (HEAD -> gitbutler/workspace) GitButler Workspace Commit
867+
* b390237 (HEAD -> gitbutler/workspace) GitButler Workspace Commit
867868
* f084d61 (C, B, A) A2
868869
* 7076dee (E, D) A1
869870
* 85efbe4 (origin/main, main) M
@@ -949,8 +950,10 @@ fn apply_with_conflicts_shows_exact_conflict_info() -> anyhow::Result<()> {
949950
└── 📙:7:main
950951
");
951952
insta::assert_snapshot!(visualize_commit_graph_all(&repo)?, @r"
952-
*-------. e86e251 (HEAD -> gitbutler/workspace) GitButler Workspace Commit
953-
|\ \ \ \ \
953+
* 4bbb93c (conflict-hero) add conflicting-F2
954+
* 98519e9 add conflicting-F1
955+
| *-----. e13e11a (HEAD -> gitbutler/workspace) GitButler Workspace Commit
956+
|/|\ \ \ \
954957
| | | | | * 34c4591 (clean-C) add C
955958
| |_|_|_|/
956959
|/| | | |
@@ -965,9 +968,6 @@ fn apply_with_conflicts_shows_exact_conflict_info() -> anyhow::Result<()> {
965968
|/|
966969
| * d3cce74 (clean-A) add A
967970
|/
968-
| * 4bbb93c (conflict-hero) add conflicting-F2
969-
| * 98519e9 add conflicting-F1
970-
|/
971971
* 85efbe4 (main) M
972972
");
973973

@@ -1071,8 +1071,11 @@ fn apply_with_conflicts_shows_exact_conflict_info() -> anyhow::Result<()> {
10711071
└── 📙:6:main
10721072
");
10731073
insta::assert_snapshot!(visualize_commit_graph_all(&repo)?, @r"
1074-
*-----. 2eed225 (HEAD -> gitbutler/workspace) GitButler Workspace Commit
1075-
|\ \ \ \
1074+
* bf09eae (conflict-F1) add F1
1075+
| * f2ce66d (conflict-F2) add F2
1076+
|/
1077+
| *---. c51f37c (HEAD -> gitbutler/workspace) GitButler Workspace Commit
1078+
|/|\ \ \
10761079
| | | | * 4bbb93c (conflict-hero) add conflicting-F2
10771080
| | | | * 98519e9 add conflicting-F1
10781081
| |_|_|/
@@ -1085,10 +1088,6 @@ fn apply_with_conflicts_shows_exact_conflict_info() -> anyhow::Result<()> {
10851088
|/|
10861089
| * d3cce74 (clean-A) add A
10871090
|/
1088-
| * bf09eae (conflict-F1) add F1
1089-
|/
1090-
| * f2ce66d (conflict-F2) add F2
1091-
|/
10921091
* 85efbe4 (main) M
10931092
");
10941093

crates/but-workspace/tests/workspace/branch/checkout.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ fn update_unborn_head() -> anyhow::Result<()> {
2424
snapshot_tree: None,
2525
num_deleted_files: 0,
2626
num_added_or_updated_files: 0,
27-
head_update: "Update refs/heads/main to Some(Object(Sha1(118ba3a86f303103ce45c23515d5cae2eca717c2)))",
27+
head_update: "Update refs/heads/main to Some(Object(Sha1(36d9c8013ccd91e3a1d53a3bc86c12ca81cc4a11)))",
2828
}
2929
"#);
3030

31-
insta::assert_snapshot!(visualize_commit_graph_all(&repo)?, @"* 118ba3a (HEAD -> main) init");
31+
insta::assert_snapshot!(visualize_commit_graph_all(&repo)?, @"* 36d9c80 (HEAD -> main) init");
3232
insta::assert_snapshot!(git_status(&repo)?, @r"");
3333
Ok(())
3434
}

crates/but-workspace/tests/workspace/commit.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ mod from_new_merge_with_metadata {
3434
insta::assert_snapshot!(commit.data.as_bstr(), @r"
3535
tree f53c91092dbda83f3565e78c285f3e2ab0cfd968
3636
parent d3cce74a69ee3b0e1cbea65b53908d602d6bda26
37-
author GitButler <[email protected]> 968492580 +0000
38-
committer GitButler <[email protected]> 968492580 +0000
37+
author GitButler <[email protected]> 946771200 +0000
38+
committer GitButler <[email protected]> 946771200 +0000
3939
encoding UTF-8
4040
4141
GitButler Workspace Commit
@@ -56,7 +56,7 @@ mod from_new_merge_with_metadata {
5656
");
5757
insta::assert_debug_snapshot!(out, @r#"
5858
Outcome {
59-
workspace_commit_id: Sha1(655bf328c5ea95493005bb2eeb9e0724b982430f),
59+
workspace_commit_id: Sha1(31f3d99d4b12a57c1c21053ab3ae5da160247044),
6060
stacks: [
6161
Stack { tip: d3cce74, name: "add-A" },
6262
],
@@ -81,7 +81,7 @@ mod from_new_merge_with_metadata {
8181
// It retains order.
8282
insta::assert_debug_snapshot!(out, @r#"
8383
Outcome {
84-
workspace_commit_id: Sha1(c4576e5fea31f865a3ce2b69db6ea4d69fbfb107),
84+
workspace_commit_id: Sha1(391a453230c141ac5f81d7203ac90c7e66ea9acf),
8585
stacks: [
8686
Stack { tip: 27ab782, name: "add-D" },
8787
Stack { tip: d3cce74, name: "add-A" },
@@ -100,8 +100,8 @@ mod from_new_merge_with_metadata {
100100
parent d3cce74a69ee3b0e1cbea65b53908d602d6bda26
101101
parent 34c4591eac5ade7cdf094c4fc48dea798ab73bbb
102102
parent 115e41b0ffb7fcb56f91a9fb64cf4a7b786c1bea
103-
author GitButler <[email protected]> 968492580 +0000
104-
committer GitButler <[email protected]> 968492580 +0000
103+
author GitButler <[email protected]> 946771200 +0000
104+
committer GitButler <[email protected]> 946771200 +0000
105105
encoding UTF-8
106106
107107
GitButler Workspace Commit
@@ -177,7 +177,7 @@ mod from_new_merge_with_metadata {
177177
)?;
178178
insta::assert_debug_snapshot!(out, @r#"
179179
Outcome {
180-
workspace_commit_id: Sha1(2da68ddfc57b6853126b1cc2b45ee627266b85b5),
180+
workspace_commit_id: Sha1(b8ba7bd37ac1a1f9a0e7f29ddf83acc249d7b866),
181181
stacks: [
182182
Stack { tip: d3cce74, name: "clean-A" },
183183
Stack { tip: 115e41b, name: "clean-B" },
@@ -217,7 +217,7 @@ mod from_new_merge_with_metadata {
217217
WorkspaceCommit::from_new_merge_with_metadata(&to_stacks(stacks), &graph, &repo, None)?;
218218
insta::assert_debug_snapshot!(out, @r#"
219219
Outcome {
220-
workspace_commit_id: Sha1(63eb0a124467632279d5367b81d5b5627c929ca3),
220+
workspace_commit_id: Sha1(e444bfa38570217271f5df56c3fe26ed57a7e023),
221221
stacks: [
222222
Stack { tip: d3cce74, name: "clean-A" },
223223
Stack { tip: bf09eae, name: "conflict-F1" },
@@ -286,7 +286,7 @@ mod from_new_merge_with_metadata {
286286
WorkspaceCommit::from_new_merge_with_metadata(&to_stacks(stacks), &graph, &repo, None)?;
287287
insta::assert_debug_snapshot!(out, @r#"
288288
Outcome {
289-
workspace_commit_id: Sha1(ed5a3012c6a4798404f5b8586588d0ede0664683),
289+
workspace_commit_id: Sha1(e25b36b3a4192701e5e91a00d1c2fe07b9888338),
290290
stacks: [
291291
Stack { tip: 8450331, name: "tip-conflicted" },
292292
Stack { tip: 8ab1c4d, name: "unrelated" },
@@ -332,7 +332,7 @@ mod from_new_merge_with_metadata {
332332
WorkspaceCommit::from_new_merge_with_metadata(&to_stacks(stacks), &graph, &repo, None)?;
333333
insta::assert_debug_snapshot!(out, @r#"
334334
Outcome {
335-
workspace_commit_id: Sha1(02e643fe54118699dfc71edcee135ad7a825ccbf),
335+
workspace_commit_id: Sha1(4aede0de89327f3afde3db1ed9f83f368f67d501),
336336
stacks: [
337337
Stack { tip: d3cce74, name: "clean-A" },
338338
Stack { tip: 6777bd8, name: "conflict-C1" },
@@ -356,8 +356,8 @@ mod from_new_merge_with_metadata {
356356
parent d3cce74a69ee3b0e1cbea65b53908d602d6bda26
357357
parent 6777bd8aff28a87a07739e2f309d3699d93685f9
358358
parent 115e41b0ffb7fcb56f91a9fb64cf4a7b786c1bea
359-
author GitButler <[email protected]> 968492580 +0000
360-
committer GitButler <[email protected]> 968492580 +0000
359+
author GitButler <[email protected]> 946771200 +0000
360+
committer GitButler <[email protected]> 946771200 +0000
361361
encoding UTF-8
362362
363363
GitButler Workspace Commit
@@ -396,7 +396,7 @@ mod from_new_merge_with_metadata {
396396
// TODO: make clean-B show up!
397397
insta::assert_debug_snapshot!(out, @r#"
398398
Outcome {
399-
workspace_commit_id: Sha1(ef4cd3a7261c7fdba387069af08f4844bf25e657),
399+
workspace_commit_id: Sha1(fd9723d257cd09656a2f8bb24d3dd2138f88b343),
400400
stacks: [
401401
Stack { tip: d3cce74, name: "clean-A" },
402402
Stack { tip: 115e41b, name: "clean-B" },
@@ -419,8 +419,8 @@ mod from_new_merge_with_metadata {
419419
parent d3cce74a69ee3b0e1cbea65b53908d602d6bda26
420420
parent 115e41b0ffb7fcb56f91a9fb64cf4a7b786c1bea
421421
parent f8392d239500de94b23f42c8ab5508dae1b3b657
422-
author GitButler <[email protected]> 968492580 +0000
423-
committer GitButler <[email protected]> 968492580 +0000
422+
author GitButler <[email protected]> 946771200 +0000
423+
committer GitButler <[email protected]> 946771200 +0000
424424
encoding UTF-8
425425
426426
GitButler Workspace Commit
@@ -458,7 +458,7 @@ mod from_new_merge_with_metadata {
458458
)?;
459459
insta::assert_debug_snapshot!(out, @r#"
460460
Outcome {
461-
workspace_commit_id: Sha1(6be4e1cdd58cd6b0564a518e9d55a59408352255),
461+
workspace_commit_id: Sha1(e297aee321879eb991bb5360859cbddb5891a316),
462462
stacks: [
463463
Stack { tip: 6777bd8, name: "conflict-C1" },
464464
Stack { tip: d3cce74, name: "clean-A" },

crates/but-workspace/tests/workspace/utils.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ fn writable_scenario_inner(
3030

3131
fn freeze_time(opts: gix::open::Options) -> gix::open::Options {
3232
use gix::config::tree::{User, gitoxide};
33-
let time = "968492580 +0000".into();
33+
// Note: this should equal what's used other free-time functions that
34+
// are environment based, as env-vars override this.
35+
// TODO: don't allow the test-suite to change the current environment (which was needed to help old code)
36+
let time = "946771200 +0000".into();
3437
opts.config_overrides(
3538
[
3639
User::NAME.validated_assignment("user".into()),

0 commit comments

Comments
 (0)