Fast implementation of Git in pure Go codeberg.org/lindenii/furgit
git go
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

reachability: Don't have a separate New for commit graphs

Runxi Yu 8c135d16 f40daef1

+11 -18
+1 -1
reachability/integration_test.go
··· 249 249 func openReachabilityFromTestRepo(t *testing.T, testRepo *testgit.TestRepo) *reachability.Reachability { 250 250 t.Helper() 251 251 252 - return reachability.New(testRepo.OpenObjectStore(t)) 252 + return reachability.New(testRepo.OpenObjectStore(t), nil) 253 253 } 254 254 255 255 func oidSetFromSeq(seq func(func(objectid.ObjectID) bool)) map[objectid.ObjectID]struct{} {
+3 -10
reachability/reachability.go
··· 14 14 graph *commitgraphread.Reader 15 15 } 16 16 17 - // New builds a Reachability over one object store. 17 + // New builds a Reachability over one object store with an optional 18 + // commit-graph reader for faster commit-domain traversal. 18 19 // 19 20 // Labels: Deps-Borrowed. 20 - func New(store objectstore.ReadingStore) *Reachability { 21 - return &Reachability{store: store} 22 - } 23 - 24 - // NewWithCommitGraph builds a Reachability over one object store with an 25 - // optional commit-graph reader for faster commit-domain traversal. 26 - // 27 - // Labels: Deps-Borrowed. 28 - func NewWithCommitGraph(store objectstore.ReadingStore, graph *commitgraphread.Reader) *Reachability { 21 + func New(store objectstore.ReadingStore, graph *commitgraphread.Reader) *Reachability { 29 22 return &Reachability{store: store, graph: graph} 30 23 }
+7 -7
reachability/unit_test.go
··· 94 94 tag1 := store.AddObject(objecttype.TypeTag, tagBody(commit2, objecttype.TypeCommit)) 95 95 tag2 := store.AddObject(objecttype.TypeTag, tagBody(tag1, objecttype.TypeTag)) 96 96 97 - r := reachability.New(store) 97 + r := reachability.New(store, nil) 98 98 walk := r.Walk(reachability.DomainCommits, nil, map[objectid.ObjectID]struct{}{tag2: {}}) 99 99 100 100 got := collectSeq(walk.Seq()) ··· 126 126 }}})) 127 127 commit := store.AddObject(objecttype.TypeCommit, commitBody(tree)) 128 128 129 - r := reachability.New(store) 129 + r := reachability.New(store, nil) 130 130 walk := r.Walk(reachability.DomainCommits, map[objectid.ObjectID]struct{}{commit: {}}, map[objectid.ObjectID]struct{}{commit: {}}) 131 131 132 132 got := collectSeq(walk.Seq()) ··· 155 155 }}})) 156 156 tag := store.AddObject(objecttype.TypeTag, tagBody(tree, objecttype.TypeTree)) 157 157 158 - r := reachability.New(store) 158 + r := reachability.New(store, nil) 159 159 walk := r.Walk(reachability.DomainCommits, nil, map[objectid.ObjectID]struct{}{tag: {}}) 160 160 _ = collectSeq(walk.Seq()) 161 161 ··· 191 191 tag1 := store.AddObject(objecttype.TypeTag, tagBody(commit2, objecttype.TypeCommit)) 192 192 tag2 := store.AddObject(objecttype.TypeTag, tagBody(tag1, objecttype.TypeTag)) 193 193 194 - r := reachability.New(store) 194 + r := reachability.New(store, nil) 195 195 walk := r.Walk( 196 196 reachability.DomainCommits, 197 197 map[objectid.ObjectID]struct{}{tag1: {}}, ··· 236 236 }})) 237 237 commit := store.AddObject(objecttype.TypeCommit, commitBody(rootTree)) 238 238 239 - r := reachability.New(store) 239 + r := reachability.New(store, nil) 240 240 walk := r.Walk(reachability.DomainObjects, nil, map[objectid.ObjectID]struct{}{commit: {}}) 241 241 242 242 got := collectSeq(walk.Seq()) ··· 273 273 missingParent := store.Algorithm().Sum([]byte("missing-parent")) 274 274 commit := store.AddObject(objecttype.TypeCommit, commitBody(tree, missingParent)) 275 275 276 - r := reachability.New(store) 276 + r := reachability.New(store, nil) 277 277 278 278 err := r.CheckConnected(reachability.DomainCommits, nil, map[objectid.ObjectID]struct{}{commit: {}}) 279 279 if err == nil { ··· 295 295 t.Parallel() 296 296 297 297 testgit.ForEachAlgorithm(t, func(t *testing.T, algo objectid.Algorithm) { //nolint:thelper 298 - r := reachability.New(newCountingMemStore(algo)) 298 + r := reachability.New(newCountingMemStore(algo), nil) 299 299 walk := r.Walk(reachability.Domain(99), nil, nil) 300 300 301 301 _ = collectSeq(walk.Seq())