Fast implementation of Git in pure Go
at master 26 lines 576 B view raw
1package testgit 2 3import ( 4 "testing" 5 6 commitgraphread "codeberg.org/lindenii/furgit/format/commitgraph/read" 7) 8 9// OpenCommitGraph opens the repository commit-graph and registers cleanup on 10// the caller. 11func (testRepo *TestRepo) OpenCommitGraph(tb testing.TB) *commitgraphread.Reader { 12 tb.Helper() 13 14 objectsRoot := testRepo.OpenObjectsRoot(tb) 15 16 graph, err := commitgraphread.Open(objectsRoot, testRepo.Algorithm(), commitgraphread.OpenSingle) 17 if err != nil { 18 tb.Fatalf("commitgraphread.Open: %v", err) 19 } 20 21 tb.Cleanup(func() { 22 _ = graph.Close() 23 }) 24 25 return graph 26}