Commit 532722c
committed
Tests: Build git fixtures via gix instead of CLI
- The git module's test fixtures used to chain `fork+exec` of `git` for every init / commit / branch / checkout. A modest fixture like `build_repo_with_branches(&[("a", 5), ("b", 1), ("c", 2)])` spawned ~31 `git` processes; under `./scripts/check.sh` parallel-check contention the per-spawn cost climbed enough to push two tests over the intentional 8 s nextest cap.
- New `file_system/git/test_fixtures.rs` exposes a `Fixture` wrapper around `gix::Repository` plus `build_simple_repo` / `build_repo_with_branches` helpers. Init, commit, branch, checkout, and lightweight tag creation all run in-process; the index file is synced after each commit so `list_status` and `git checkout` follow-ups still work. `commit_files_with_modes` lets the executable-bit test pin `EntryKind::BlobExecutable` directly.
- Migrated `tests.rs`, `m2_tests.rs`, `m3_tests.rs`, `m4_tests.rs`, `snapshot_dates_tests.rs` end-to-end. The handful of operations gix 0.81 doesn't expose publicly (stash creation, `git worktree add`, `git submodule add`, detach HEAD, bare init) keep a thin `git_cli` shell-out — one or two calls per affected test, no longer the dominant cost.
- Enabled the `tree-editor` feature on the existing `gix` dep (already 56 sub-crates in lockfile; pure API addition, no new transitive deps).
- `bench.rs` stays on CLI (all `#[ignore]`-gated, fixture cached). `status.rs::cache_tests` stays on CLI (uses `git add` without commit, needs raw index manipulation, low value to migrate).
- Result: 91 git module tests now total ~1.7 s wall-clock (was tens of seconds). The cancellation test that had timed out at 8 s runs in 73 ms.1 parent f4c0b5a commit 532722c
8 files changed
Lines changed: 668 additions & 486 deletions
File tree
- apps/desktop/src-tauri
- src/file_system/git
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
111 | 117 | | |
112 | 118 | | |
113 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
10 | | - | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | 20 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
| 21 | + | |
61 | 22 | | |
62 | 23 | | |
63 | 24 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
| 25 | + | |
| 26 | + | |
68 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
69 | 32 | | |
70 | | - | |
71 | 33 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
81 | 48 | | |
82 | | - | |
83 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
84 | 69 | | |
85 | 70 | | |
86 | 71 | | |
| |||
335 | 320 | | |
336 | 321 | | |
337 | 322 | | |
338 | | - | |
| 323 | + | |
339 | 324 | | |
340 | 325 | | |
341 | 326 | | |
| |||
426 | 411 | | |
427 | 412 | | |
428 | 413 | | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
434 | 433 | | |
435 | 434 | | |
436 | 435 | | |
| |||
0 commit comments