MCPcopy Create free account
hub / github.com/go-git/go-git / benchmarkStatusClean

Function benchmarkStatusClean

worktree_status_bench_test.go:101–113  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

99// This represents the worst-case scenario for the current implementation where
100// every file's hash is computed unnecessarily since nothing has changed.
101func 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

Callers 2

BenchmarkStatusFunction · 0.85
BenchmarkStatusLargeFunction · 0.85

Calls 2

StatusMethod · 0.45
IsCleanMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…