Fast implementation of Git in pure Go
at master 39 lines 726 B view raw
1package commitquery 2 3import ( 4 commitgraphread "codeberg.org/lindenii/furgit/commitgraph/read" 5 "codeberg.org/lindenii/furgit/objectid" 6) 7 8// nodeIndex identifies one internal query node. 9type nodeIndex int 10 11// node stores one mutable commit traversal node. 12type node struct { 13 id objectid.ObjectID 14 15 parents []nodeIndex 16 17 commitTime int64 18 generation uint64 19 20 hasGeneration bool 21 hasGraphPos bool 22 loaded bool 23 24 graphPos commitgraphread.Position 25 marks markBits 26 27 touchedPhase uint32 28} 29 30// newNode allocates one empty internal node. 31func (query *Query) newNode(id objectid.ObjectID) nodeIndex { 32 count := len(query.nodes) 33 34 idx := nodeIndex(count) 35 36 query.nodes = append(query.nodes, node{id: id}) 37 38 return idx 39}