MCPcopy Index your code
hub / github.com/go-git/go-git / readEntryName

Method readEntryName

plumbing/format/index/decoder.go:155–175  ·  view source on GitHub ↗

readEntryName reads the entry path and sets e.Name. It returns the number of bytes consumed from the stream for the name portion.

(idx *Index, e *Entry, flags uint16)

Source from the content-addressed store, hash-verified

153// readEntryName reads the entry path and sets e.Name. It returns the
154// number of bytes consumed from the stream for the name portion.
155func (d *Decoder) readEntryName(idx *Index, e *Entry, flags uint16) (int, error) {
156 switch idx.Version {
157 case 2, 3:
158 nameLen := flags & nameMask
159 name, consumed, err := d.doReadEntryName(nameLen)
160 if err != nil {
161 return 0, err
162 }
163 e.Name = name
164 return consumed, nil
165 case 4:
166 name, err := d.doReadEntryNameV4()
167 if err != nil {
168 return 0, err
169 }
170 e.Name = name
171 return 0, nil // V4 has no padding; consumed count unused
172 default:
173 return 0, ErrUnsupportedVersion
174 }
175}
176
177// doReadEntryName reads the entry path for V2/V3 indexes. It returns the
178// name, the number of bytes consumed from the stream, and any error.

Callers 1

readEntryMethod · 0.95

Calls 2

doReadEntryNameMethod · 0.95
doReadEntryNameV4Method · 0.95

Tested by

no test coverage detected