benchmarkStatusClean returns a benchmark function for testing Status() on a clean repository. This represents the worst-case scenario for the current implementation where every file's hash is computed unnecessarily since nothing has changed.
(wt *Worktree)
| 99 | // This represents the worst-case scenario for the current implementation where |
| 100 | // every file's hash is computed unnecessarily since nothing has changed. |
| 101 | func benchmarkStatusClean(wt *Worktree) func(b *testing.B) { |
| 102 | return func(b *testing.B) { |
| 103 | for b.Loop() { |
| 104 | status, err := wt.Status() |
| 105 | if err != nil { |
| 106 | b.Fatalf("failed to get status: %v", err) |
| 107 | } |
| 108 | if !status.IsClean() { |
| 109 | b.Fatalf("expected clean status, got: %v", status) |
| 110 | } |
| 111 | } |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | // benchmarkStatusModified returns a benchmark function for testing Status() on a repository |
| 116 | // with some modified files. This represents a more realistic scenario where a small |
no test coverage detected
searching dependent graphs…