| 1 | package idxfilescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/ |
| 2 | |
| 3 | import ( |
| 4 | "bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/" |
| 5 | "fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/" |
| 6 | "mathscip-go gomod github.com/golang/go/src go1.25.0 math/" |
| 7 | "sortscip-go gomod github.com/golang/go/src go1.25.0 sort/" |
| 8 | "syncscip-go gomod github.com/golang/go/src go1.25.0 sync/" |
| 9 | |
| 10 | "github.com/go-git/go-git/v6/plumbingscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/" |
| 11 | "github.com/go-git/go-git/v6/utils/binaryscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/utils/binary`/" |
| 12 | ) |
| 13 | |
| 14 | // objects implements sort.Interface and uses hash as sorting key. |
| 15 | type objectsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/objects# []Entryscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Entry# |
| 16 | |
| 17 | // Writer implements a packfile Observer interface and is used to generate |
| 18 | // indexes. |
| 19 | type Writerscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer# struct { |
| 20 | mscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#m. syncscip-go gomod github.com/golang/go/src go1.25.0 sync/.Mutexscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex# |
| 21 | |
| 22 | countscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#count. uint32 |
| 23 | checksumscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#checksum. plumbingscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/.Hashscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/Hash# |
| 24 | objectsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#objects. objectsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/objects# |
| 25 | offset64scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#offset64. uint32 |
| 26 | finishedscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#finished. bool |
| 27 | indexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#index. *MemoryIndexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex# |
| 28 | addedscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#added. map[plumbingscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/.Hashscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/Hash#]struct{} |
| 29 | } |
| 30 | |
| 31 | // Index returns a previously created MemoryIndex or creates a new one if |
| 32 | // needed. |
| 33 | func (w *Writerscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#) Indexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#Index().() (*MemoryIndexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#, error) { |
| 34 | w.mscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#m..Lockscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex#Lock().() |
| 35 | defer w.mscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#m..Unlockscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex#Unlock().() |
| 36 | |
| 37 | if w.indexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#index. == nil { |
| 38 | return w.createIndexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#createIndex().() |
| 39 | } |
| 40 | |
| 41 | return w.indexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#index., nil |
| 42 | } |
| 43 | |
| 44 | // Add appends new object data. |
| 45 | func (w *Writerscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#) Addscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#Add().(h plumbingscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/.Hashscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/Hash#, pos uint64, crc uint32) { |
| 46 | // Skip unmaterialised delta objects. |
| 47 | if h.IsZeroscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/ObjectID#IsZero().() { |
| 48 | return |
| 49 | } |
| 50 | |
| 51 | w.mscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#m..Lockscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex#Lock().() |
| 52 | defer w.mscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#m..Unlockscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex#Unlock().() |
| 53 | |
| 54 | if w.addedscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#added. == nil { |
| 55 | w.addedscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#added. = make(map[plumbingscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/.Hashscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/Hash#]struct{}) |
| 56 | } |
| 57 | |
| 58 | if _, ok := w.addedscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#added.[h]; !ok { |
| 59 | w.addedscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#added.[h] = struct{}{} |
| 60 | w.objectsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#objects. = append(w.objectsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#objects., Entryscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Entry#{h, crc, pos}) |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | // Finished returns true if the writer has finished writing. |
| 65 | func (w *Writerscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#) Finishedscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#Finished().() bool { |
| 66 | return w.finishedscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#finished. |
| 67 | } |
| 68 | |
| 69 | // OnHeader implements packfile.Observer interface. |
| 70 | func (w *Writerscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#) OnHeaderscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#OnHeader().(count uint32) error { |
| 71 | w.countscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#count. = count |
| 72 | w.objectsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#objects. = make(objectsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/objects#, 0, count) |
| 73 | return nil |
| 74 | } |
| 75 | |
| 76 | // OnInflatedObjectHeader implements packfile.Observer interface. |
| 77 | func (w *Writerscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#) OnInflatedObjectHeaderscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#OnInflatedObjectHeader().(_ plumbingscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/.ObjectTypescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/ObjectType#, _, _ int64) error { |
| 78 | return nil |
| 79 | } |
| 80 | |
| 81 | // OnInflatedObjectContent implements packfile.Observer interface. |
| 82 | func (w *Writerscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#) OnInflatedObjectContentscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#OnInflatedObjectContent().(h plumbingscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/.Hashscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/Hash#, pos int64, crc uint32, _ []byte) error { |
| 83 | w.Addscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#Add().(h, uint64(pos), crc) |
| 84 | return nil |
| 85 | } |
| 86 | |
| 87 | // OnFooter implements packfile.Observer interface. |
| 88 | func (w *Writerscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#) OnFooterscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#OnFooter().(h plumbingscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/.Hashscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/Hash#) error { |
| 89 | w.checksumscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#checksum. = h |
| 90 | w.finishedscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#finished. = true |
| 91 | _, err := w.createIndexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#createIndex().() |
| 92 | |
| 93 | return err |
| 94 | } |
| 95 | |
| 96 | // creatIndex returns a filled MemoryIndex with the information filled by |
| 97 | // the observer callbacks. |
| 98 | func (w *Writerscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#) createIndexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#createIndex().() (*MemoryIndexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#, error) { |
| 99 | if !w.finishedscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#finished. { |
| 100 | return nil, fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("the index still hasn't finished building") |
| 101 | } |
| 102 | |
| 103 | idx := NewMemoryIndexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/NewMemoryIndex().(w.checksumscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#checksum..Sizescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/ObjectID#Size().()) |
| 104 | w.indexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#index. = idx |
| 105 | |
| 106 | sortscip-go gomod github.com/golang/go/src go1.25.0 sort/.Sortscip-go gomod github.com/golang/go/src go1.25.0 sort/Sort().(w.objectsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#objects.) |
| 107 | |
| 108 | // unmap all fans by default |
| 109 | for i := range idx.FanoutMappingscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#FanoutMapping. { |
| 110 | idx.FanoutMappingscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#FanoutMapping.[i] = noMappingscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/noMapping. |
| 111 | } |
| 112 | |
| 113 | // Pre-allocate underlying array based on expected number |
| 114 | // of objects. |
| 115 | idx.Namesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Names. = make([][]byte, 0, len(w.objectsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#objects.)) |
| 116 | idx.Offset32scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Offset32. = make([][]byte, 0, len(w.objectsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#objects.)) |
| 117 | idx.CRC32scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#CRC32. = make([][]byte, 0, len(w.objectsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#objects.)) |
| 118 | |
| 119 | buf := new(bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#) |
| 120 | |
| 121 | last := -1 |
| 122 | bucket := -1 |
| 123 | for i, o := range w.objectsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#objects. { |
| 124 | if o.Hashscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Entry#Hash..Sizescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/ObjectID#Size().() != w.checksumscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#checksum..Sizescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/ObjectID#Size().() { |
| 125 | return nil, fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("object hash size mismatch: %d instead of %d", o.Hashscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Entry#Hash..Sizescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/ObjectID#Size().(), w.checksumscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#checksum..Sizescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/ObjectID#Size().()) |
| 126 | } |
| 127 | |
| 128 | fan := o.Hashscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Entry#Hash..Bytesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/ObjectID#Bytes().()[0] |
| 129 | |
| 130 | // fill the gaps between fans |
| 131 | for j := last + 1; j < int(fan); j++ { |
| 132 | idx.Fanoutscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Fanout.[j] = uint32(i) |
| 133 | } |
| 134 | |
| 135 | // update the number of objects for this position |
| 136 | idx.Fanoutscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Fanout.[fan] = uint32(i + 1) |
| 137 | |
| 138 | // we move from one bucket to another, update counters and allocate |
| 139 | // memory |
| 140 | if last != int(fan) { |
| 141 | bucket++ |
| 142 | idx.FanoutMappingscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#FanoutMapping.[fan] = bucket |
| 143 | last = int(fan) |
| 144 | |
| 145 | idx.Namesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Names. = append(idx.Namesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Names., make([]byte, 0)) |
| 146 | idx.Offset32scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Offset32. = append(idx.Offset32scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Offset32., make([]byte, 0)) |
| 147 | idx.CRC32scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#CRC32. = append(idx.CRC32scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#CRC32., make([]byte, 0)) |
| 148 | } |
| 149 | |
| 150 | idx.Namesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Names.[bucket] = append(idx.Namesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Names.[bucket], o.Hashscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Entry#Hash..Bytesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/ObjectID#Bytes().()...) |
| 151 | |
| 152 | offset := o.Offsetscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Entry#Offset. |
| 153 | if offset > mathscip-go gomod github.com/golang/go/src go1.25.0 math/.MaxInt32scip-go gomod github.com/golang/go/src go1.25.0 math/MaxInt32. { |
| 154 | var err error |
| 155 | offset, err = w.addOffset64scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#addOffset64().(offset) |
| 156 | if err != nil { |
| 157 | return nil, err |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | buf.Truncatescip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#Truncate().(0) |
| 162 | if err := binaryscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/utils/binary`/.WriteUint32scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/utils/binary`/WriteUint32().(buf, uint32(offset)); err != nil { |
| 163 | return nil, err |
| 164 | } |
| 165 | idx.Offset32scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Offset32.[bucket] = append(idx.Offset32scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Offset32.[bucket], buf.Bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#Bytes().()...) |
| 166 | |
| 167 | buf.Truncatescip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#Truncate().(0) |
| 168 | if err := binaryscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/utils/binary`/.WriteUint32scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/utils/binary`/WriteUint32().(buf, o.CRC32scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Entry#CRC32.); err != nil { |
| 169 | return nil, err |
| 170 | } |
| 171 | idx.CRC32scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#CRC32.[bucket] = append(idx.CRC32scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#CRC32.[bucket], buf.Bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#Bytes().()...) |
| 172 | } |
| 173 | |
| 174 | for j := last + 1; j < 256; j++ { |
| 175 | idx.Fanoutscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Fanout.[j] = uint32(len(w.objectsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#objects.)) |
| 176 | } |
| 177 | |
| 178 | idx.Versionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Version. = VersionSupportedscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/VersionSupported. |
| 179 | idx.PackfileChecksumscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#PackfileChecksum. = w.checksumscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#checksum. |
| 180 | |
| 181 | return idx, nil |
| 182 | } |
| 183 | |
| 184 | func (w *Writerscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#) addOffset64scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#addOffset64().(pos uint64) (uint64, error) { |
| 185 | buf := new(bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#) |
| 186 | if err := binaryscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/utils/binary`/.WriteUint64scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/utils/binary`/WriteUint64().(buf, pos); err != nil { |
| 187 | return 0, err |
| 188 | } |
| 189 | |
| 190 | w.indexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#index..Offset64scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Offset64. = append(w.indexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#index..Offset64scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Offset64., buf.Bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#Bytes().()...) |
| 191 | index := uint64(w.offset64scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#offset64. | (1 << 31)) |
| 192 | w.offset64scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Writer#offset64.++ |
| 193 | |
| 194 | return index, nil |
| 195 | } |
| 196 | |
| 197 | func (o objectsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/objects#) Lenscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/objects#Len().() int { |
| 198 | return len(o) |
| 199 | } |
| 200 | |
| 201 | func (o objectsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/objects#) Lessscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/objects#Less().(i, j int) bool { |
| 202 | cmp := o[i].Hashscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Entry#Hash..Comparescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/ObjectID#Compare().(o[j].Hashscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Entry#Hash..Bytesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/ObjectID#Bytes().()) |
| 203 | return cmp < 0 |
| 204 | } |
| 205 | |
| 206 | func (o objectsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/objects#) Swapscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/objects#Swap().(i, j int) { |
| 207 | o[i], o[j] = o[j], o[i] |
| 208 | } |