Debian Codegraph @

plumbing/format/idxfile/idxfile.go

raw symbols SCIP
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 "cryptoscip-go gomod github.com/golang/go/src go1.25.0 crypto/"
5 encbinscip-go gomod github.com/golang/go/src go1.25.0 `encoding/binary`/ "encoding/binaryscip-go gomod github.com/golang/go/src go1.25.0 `encoding/binary`/"
6 "fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/"
7 "ioscip-go gomod github.com/golang/go/src go1.25.0 io/"
8 "sortscip-go gomod github.com/golang/go/src go1.25.0 sort/"
9 "syncscip-go gomod github.com/golang/go/src go1.25.0 sync/"
10
11 "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`/"
12 )
13
14 const (
15 // VersionSupported is the only idx version supported.
16 VersionSupportedscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/VersionSupported. = 2
17
18 noMappingscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/noMapping. = -1
19 )
20
21 var idxHeaderscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxHeader. = []byte{255, 't', 'O', 'c'}
22
23 // Index represents an index of a packfile.
24 type Indexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Index# interface {
25 // Contains checks whether the given hash is in the index.
26 Containsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Index#Contains.(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#) (bool, error)
27 // FindOffset finds the offset in the packfile for the object with
28 // the given hash.
29 FindOffsetscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Index#FindOffset.(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#) (int64, error)
30 // FindCRC32 finds the CRC32 of the object with the given hash.
31 FindCRC32scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Index#FindCRC32.(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#) (uint32, error)
32 // FindHash finds the hash for the object with the given offset.
33 FindHashscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Index#FindHash.(o int64) (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)
34 // Count returns the number of entries in the index.
35 Countscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Index#Count.() (int64, error)
36 // Entries returns an iterator to retrieve all index entries.
37 Entriesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Index#Entries.() (EntryIterscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/EntryIter#, error)
38 // EntriesByOffset returns an iterator to retrieve all index entries ordered
39 // by offset.
40 EntriesByOffsetscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Index#EntriesByOffset.() (EntryIterscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/EntryIter#, error)
41 }
42
43 // MemoryIndex is the in memory representation of an idx file.
44 //
45 // The use of MemoryIndex for large repositories is discouraged.
46 // Use [LazyIndex] instead.
47 type MemoryIndexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex# struct {
48 // Version is the version of the index file.
49 Versionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Version. uint32
50 // Fanout is a table where the Nth entry is the cumulative count of objects with the first byte of their name <= N.
51 Fanoutscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Fanout. [256]uint32
52 // FanoutMapping maps the position in the fanout table to the position
53 // in the Names, Offset32 and CRC32 slices. This improves the memory
54 // usage by not needing an array with unnecessary empty slots.
55 FanoutMappingscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#FanoutMapping. [256]int
56 // Names is the list of object names.
57 Namesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Names. [][]byte
58 // Offset32 is the list of 32-bit offsets.
59 Offset32scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Offset32. [][]byte
60 // CRC32 is the list of CRC32 checksums.
61 CRC32scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#CRC32. [][]byte
62 // Offset64 is the list of 64-bit offsets.
63 Offset64scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Offset64. []byte
64 // PackfileChecksum is the checksum of the packfile.
65 PackfileChecksumscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#PackfileChecksum. 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#
66 // IdxChecksum is the checksum of the index file.
67 IdxChecksumscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#IdxChecksum. 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#
68
69 offsetHashscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#offsetHash. map[int64]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#
70 offsetBuildOncescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#offsetBuildOnce. syncscip-go gomod github.com/golang/go/src go1.25.0 sync/.Oncescip-go gomod github.com/golang/go/src go1.25.0 sync/Once#
71 muscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#mu. syncscip-go gomod github.com/golang/go/src go1.25.0 sync/.RWMutexscip-go gomod github.com/golang/go/src go1.25.0 sync/RWMutex#
72
73 objectIDSizescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#objectIDSize. int
74 }
75
76 var _ Indexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Index# = (*MemoryIndexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#)(nil)
77
78 // NewMemoryIndex returns an instance of a new MemoryIndex.
79 func NewMemoryIndexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/NewMemoryIndex().(objectIDSize int) *MemoryIndexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex# {
80 m := &MemoryIndexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#{objectIDSizescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#objectIDSize.: objectIDSize}
81 m.IdxChecksumscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#IdxChecksum..ResetBySizescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/ObjectID#ResetBySize().(objectIDSize)
82 m.PackfileChecksumscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#PackfileChecksum..ResetBySizescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/ObjectID#ResetBySize().(objectIDSize)
83 return m
84 }
85
86 func (idx *MemoryIndexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#) findHashIndexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#findHashIndex().(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#) (int, bool) {
87 k := idx.FanoutMappingscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#FanoutMapping.[h.Bytesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/ObjectID#Bytes().()[0]]
88 if k == noMappingscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/noMapping. {
89 return 0, false
90 }
91
92 if len(idx.Namesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Names.) <= k {
93 return 0, false
94 }
95
96 data := idx.Namesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Names.[k]
97 high := uint64(len(idx.Offset32scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Offset32.[k])) >> 2
98 if high == 0 {
99 return 0, false
100 }
101
102 low := uint64(0)
103 for {
104 mid := (low + high) >> 1
105 offset := mid * uint64(idx.idSizescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#idSize().())
106
107 cmp := h.Comparescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/ObjectID#Compare().(data[offset : offset+uint64(idx.idSizescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#idSize().())])
108 switch {
109 case cmp < 0:
110 high = mid
111 case cmp == 0:
112 return int(mid), true
113 default:
114 low = mid + 1
115 }
116
117 if low >= high {
118 break
119 }
120 }
121
122 return 0, false
123 }
124
125 // Contains implements the Index interface.
126 func (idx *MemoryIndexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#) Containsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Contains().(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#) (bool, error) {
127 _, ok := idx.findHashIndexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#findHashIndex().(h)
128 return ok, nil
129 }
130
131 // FindOffset implements the Index interface.
132 func (idx *MemoryIndexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#) FindOffsetscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#FindOffset().(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#) (int64, error) {
133 fo := h.Bytesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/ObjectID#Bytes().()[0]
134 if len(idx.FanoutMappingscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#FanoutMapping.) <= int(fo) {
135 return 0, plumbingscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/.ErrObjectNotFoundscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/ErrObjectNotFound.
136 }
137
138 k := idx.FanoutMappingscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#FanoutMapping.[fo]
139 i, ok := idx.findHashIndexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#findHashIndex().(h)
140 if !ok {
141 return 0, plumbingscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/.ErrObjectNotFoundscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/ErrObjectNotFound.
142 }
143
144 offset, err := idx.getOffsetscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#getOffset().(k, i)
145 if err != nil {
146 return 0, err
147 }
148
149 // Save the offset for reverse lookup
150 idx.muscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#mu..Lockscip-go gomod github.com/golang/go/src go1.25.0 sync/RWMutex#Lock().()
151 if idx.offsetHashscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#offsetHash. == nil {
152 idx.offsetHashscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#offsetHash. = make(map[int64]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#)
153 }
154 idx.offsetHashscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#offsetHash.[int64(offset)] = h
155 idx.muscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#mu..Unlockscip-go gomod github.com/golang/go/src go1.25.0 sync/RWMutex#Unlock().()
156
157 return int64(offset), nil
158 }
159
160 const isO64Maskscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/isO64Mask. = uint64(1) << 31
161
162 func (idx *MemoryIndexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#) getOffsetscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#getOffset().(firstLevel, secondLevel int) (uint64, error) {
163 offset := secondLevel << 2
164 ofs := encbinscip-go gomod github.com/golang/go/src go1.25.0 `encoding/binary`/.BigEndianscip-go gomod github.com/golang/go/src go1.25.0 `encoding/binary`/BigEndian..Uint32scip-go gomod github.com/golang/go/src go1.25.0 `encoding/binary`/bigEndian#Uint32().(idx.Offset32scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Offset32.[firstLevel][offset : offset+4])
165
166 if (uint64(ofs) & isO64Maskscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/isO64Mask.) != 0 {
167 offset := 8 * (uint64(ofs) & ^isO64Maskscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/isO64Mask.)
168 if l := uint64(len(idx.Offset64scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Offset64.)); l < 8 || offset > l-8 {
169 return 0, 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().("%w: offset64 index out of range", ErrMalformedIdxFilescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/ErrMalformedIdxFile.)
170 }
171 return encbinscip-go gomod github.com/golang/go/src go1.25.0 `encoding/binary`/.BigEndianscip-go gomod github.com/golang/go/src go1.25.0 `encoding/binary`/BigEndian..Uint64scip-go gomod github.com/golang/go/src go1.25.0 `encoding/binary`/bigEndian#Uint64().(idx.Offset64scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Offset64.[offset : offset+8]), nil
172 }
173
174 return uint64(ofs), nil
175 }
176
177 // FindCRC32 implements the Index interface.
178 func (idx *MemoryIndexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#) FindCRC32scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#FindCRC32().(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#) (uint32, error) {
179 k := idx.FanoutMappingscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#FanoutMapping.[h.Bytesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/ObjectID#Bytes().()[0]]
180 i, ok := idx.findHashIndexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#findHashIndex().(h)
181 if !ok {
182 return 0, plumbingscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/.ErrObjectNotFoundscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/ErrObjectNotFound.
183 }
184
185 return idx.getCRC32scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#getCRC32().(k, i), nil
186 }
187
188 func (idx *MemoryIndexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#) getCRC32scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#getCRC32().(firstLevel, secondLevel int) uint32 {
189 offset := secondLevel << 2
190 return encbinscip-go gomod github.com/golang/go/src go1.25.0 `encoding/binary`/.BigEndianscip-go gomod github.com/golang/go/src go1.25.0 `encoding/binary`/BigEndian..Uint32scip-go gomod github.com/golang/go/src go1.25.0 `encoding/binary`/bigEndian#Uint32().(idx.CRC32scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#CRC32.[firstLevel][offset : offset+4])
191 }
192
193 // FindHash implements the Index interface.
194 func (idx *MemoryIndexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#) FindHashscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#FindHash().(o int64) (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) {
195 var hash 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#
196 var ok bool
197
198 idx.muscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#mu..RLockscip-go gomod github.com/golang/go/src go1.25.0 sync/RWMutex#RLock().()
199 if idx.offsetHashscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#offsetHash. != nil {
200 if hash, ok = idx.offsetHashscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#offsetHash.[o]; ok {
201 idx.muscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#mu..RUnlockscip-go gomod github.com/golang/go/src go1.25.0 sync/RWMutex#RUnlock().()
202 return hash, nil
203 }
204 }
205 idx.muscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#mu..RUnlockscip-go gomod github.com/golang/go/src go1.25.0 sync/RWMutex#RUnlock().()
206
207 var genErr error
208 idx.offsetBuildOncescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#offsetBuildOnce..Doscip-go gomod github.com/golang/go/src go1.25.0 sync/Once#Do().(func() {
209 genErr = idx.genOffsetHashscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#genOffsetHash().()
210 })
211 if genErr != nil {
212 return plumbingscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/.ZeroHashscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/ZeroHash., genErr
213 }
214
215 idx.muscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#mu..RLockscip-go gomod github.com/golang/go/src go1.25.0 sync/RWMutex#RLock().()
216 hash, ok = idx.offsetHashscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#offsetHash.[o]
217 idx.muscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#mu..RUnlockscip-go gomod github.com/golang/go/src go1.25.0 sync/RWMutex#RUnlock().()
218
219 if !ok {
220 return plumbingscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/.ZeroHashscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/ZeroHash., plumbingscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/.ErrObjectNotFoundscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/ErrObjectNotFound.
221 }
222
223 return hash, nil
224 }
225
226 // genOffsetHash generates the offset/hash mapping for reverse search.
227 func (idx *MemoryIndexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#) genOffsetHashscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#genOffsetHash().() error {
228 count, err := idx.Countscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Count().()
229 if err != nil {
230 return err
231 }
232
233 offsetHash := make(map[int64]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#, count)
234
235 var hash 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#
236 hash.ResetBySizescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/ObjectID#ResetBySize().(idx.objectIDSizescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#objectIDSize.)
237
238 i := uint32(0)
239 for firstLevel, fanoutValue := range idx.Fanoutscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Fanout. {
240 mappedFirstLevel := idx.FanoutMappingscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#FanoutMapping.[firstLevel]
241 for secondLevel := uint32(0); i < fanoutValue; i++ {
242 _, err = hash.Writescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/ObjectID#Write().(idx.Namesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Names.[mappedFirstLevel][secondLevel*uint32(idx.idSizescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#idSize().()):])
243 if err != nil {
244 return 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().("cannot write name to hash: %w", err)
245 }
246
247 off, err := idx.getOffsetscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#getOffset().(mappedFirstLevel, int(secondLevel))
248 if err != nil {
249 return err
250 }
251 offsetHash[int64(off)] = hash
252 secondLevel++
253 }
254 }
255
256 idx.muscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#mu..Lockscip-go gomod github.com/golang/go/src go1.25.0 sync/RWMutex#Lock().()
257 idx.offsetHashscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#offsetHash. = offsetHash
258 idx.muscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#mu..Unlockscip-go gomod github.com/golang/go/src go1.25.0 sync/RWMutex#Unlock().()
259
260 return nil
261 }
262
263 // Count implements the Index interface.
264 func (idx *MemoryIndexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#) Countscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Count().() (int64, error) {
265 return int64(idx.Fanoutscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Fanout.[fanoutscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/fanout.-1]), nil
266 }
267
268 // Entries implements the Index interface.
269 func (idx *MemoryIndexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#) Entriesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Entries().() (EntryIterscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/EntryIter#, error) {
270 return &idxfileEntryIterscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryIter#{idx, 0, 0, 0}, nil
271 }
272
273 // EntriesByOffset implements the Index interface.
274 func (idx *MemoryIndexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#) EntriesByOffsetscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#EntriesByOffset().() (EntryIterscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/EntryIter#, error) {
275 count, err := idx.Countscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Count().()
276 if err != nil {
277 return nil, err
278 }
279
280 iter := &idxfileEntryOffsetIterscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryOffsetIter#{
281 entriesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryOffsetIter#entries.: make(entriesByOffsetscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/entriesByOffset#, count),
282 }
283
284 entries, err := idx.Entriesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Entries().()
285 if err != nil {
286 return nil, err
287 }
288
289 for pos := 0; int64(pos) < count; pos++ {
290 entry, err := entries.Nextscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/EntryIter#Next.()
291 if err != nil {
292 return nil, err
293 }
294
295 iter.entriesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryOffsetIter#entries.[pos] = entry
296 }
297
298 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().(iter.entriesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryOffsetIter#entries.)
299
300 return iter, nil
301 }
302
303 func (idx *MemoryIndexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#) idSizescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#idSize().() int {
304 if idx.objectIDSizescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#objectIDSize. != 0 {
305 return idx.objectIDSizescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#objectIDSize.
306 }
307 return cryptoscip-go gomod github.com/golang/go/src go1.25.0 crypto/.SHA1scip-go gomod github.com/golang/go/src go1.25.0 crypto/SHA1..Sizescip-go gomod github.com/golang/go/src go1.25.0 crypto/Hash#Size().()
308 }
309
310 // EntryIter is an iterator that will return the entries in a packfile index.
311 type EntryIterscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/EntryIter# interface {
312 // Next returns the next entry in the packfile index.
313 Nextscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/EntryIter#Next.() (*Entryscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Entry#, error)
314 // Close closes the iterator.
315 Closescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/EntryIter#Close.() error
316 }
317
318 type idxfileEntryIterscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryIter# struct {
319 idxscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryIter#idx. *MemoryIndexscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#
320 totalscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryIter#total. int
321 firstLevelscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryIter#firstLevel., secondLevelscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryIter#secondLevel. int
322 }
323
324 func (i *idxfileEntryIterscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryIter#) Nextscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryIter#Next().() (*Entryscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Entry#, error) {
325 for {
326 if i.firstLevelscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryIter#firstLevel. >= fanoutscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/fanout. {
327 return nil, ioscip-go gomod github.com/golang/go/src go1.25.0 io/.EOFscip-go gomod github.com/golang/go/src go1.25.0 io/EOF.
328 }
329
330 if i.totalscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryIter#total. >= int(i.idxscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryIter#idx..Fanoutscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Fanout.[i.firstLevelscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryIter#firstLevel.]) {
331 i.firstLevelscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryIter#firstLevel.++
332 i.secondLevelscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryIter#secondLevel. = 0
333 continue
334 }
335
336 mappedFirstLevel := i.idxscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryIter#idx..FanoutMappingscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#FanoutMapping.[i.firstLevelscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryIter#firstLevel.]
337 entry := new(Entryscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Entry#)
338 entry.Hashscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Entry#Hash..ResetBySizescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/ObjectID#ResetBySize().(i.idxscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryIter#idx..idSizescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#idSize().())
339 _, err := entry.Hashscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Entry#Hash..Writescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/ObjectID#Write().(i.idxscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryIter#idx..Namesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#Names.[mappedFirstLevel][i.secondLevelscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryIter#secondLevel.*i.idxscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryIter#idx..idSizescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#idSize().():])
340 if err != nil {
341 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().("cannot write entry hash: %w", err)
342 }
343
344 entry.Offsetscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Entry#Offset., err = i.idxscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryIter#idx..getOffsetscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#getOffset().(mappedFirstLevel, i.secondLevelscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryIter#secondLevel.)
345 if err != nil {
346 return nil, err
347 }
348 entry.CRC32scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Entry#CRC32. = i.idxscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryIter#idx..getCRC32scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/MemoryIndex#getCRC32().(mappedFirstLevel, i.secondLevelscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryIter#secondLevel.)
349
350 i.secondLevelscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryIter#secondLevel.++
351 i.totalscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryIter#total.++
352
353 return entry, nil
354 }
355 }
356
357 func (i *idxfileEntryIterscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryIter#) Closescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryIter#Close().() error {
358 i.firstLevelscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryIter#firstLevel. = fanoutscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/fanout.
359 return nil
360 }
361
362 // Entry is the in memory representation of an object entry in the idx file.
363 type Entryscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Entry# struct {
364 Hashscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Entry#Hash. 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#
365 CRC32scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Entry#CRC32. uint32
366 Offsetscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Entry#Offset. uint64
367 }
368
369 type idxfileEntryOffsetIterscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryOffsetIter# struct {
370 entriesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryOffsetIter#entries. entriesByOffsetscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/entriesByOffset#
371 posscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryOffsetIter#pos. int
372 }
373
374 func (i *idxfileEntryOffsetIterscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryOffsetIter#) Nextscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryOffsetIter#Next().() (*Entryscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Entry#, error) {
375 if i.posscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryOffsetIter#pos. >= len(i.entriesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryOffsetIter#entries.) {
376 return nil, ioscip-go gomod github.com/golang/go/src go1.25.0 io/.EOFscip-go gomod github.com/golang/go/src go1.25.0 io/EOF.
377 }
378
379 entry := i.entriesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryOffsetIter#entries.[i.posscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryOffsetIter#pos.]
380 i.posscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryOffsetIter#pos.++
381
382 return entry, nil
383 }
384
385 func (i *idxfileEntryOffsetIterscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryOffsetIter#) Closescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryOffsetIter#Close().() error {
386 i.posscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryOffsetIter#pos. = len(i.entriesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/idxfileEntryOffsetIter#entries.) + 1
387 return nil
388 }
389
390 type entriesByOffsetscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/entriesByOffset# []*Entryscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Entry#
391
392 func (o entriesByOffsetscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/entriesByOffset#) Lenscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/entriesByOffset#Len().() int {
393 return len(o)
394 }
395
396 func (o entriesByOffsetscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/entriesByOffset#) Lessscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/entriesByOffset#Less().(i, j int) bool {
397 return o[i].Offsetscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Entry#Offset. < o[j].Offsetscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/Entry#Offset.
398 }
399
400 func (o entriesByOffsetscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/entriesByOffset#) Swapscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/idxfile`/entriesByOffset#Swap().(i, j int) {
401 o[i], o[j] = o[j], o[i]
402 }