MCPcopy Create free account
hub / github.com/go-git/go-git / readEntry

Method readEntry

plumbing/format/index/decoder.go:353–396  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

351}
352
353func (d *treeExtensionDecoder) readEntry() (*TreeEntry, error) {
354 e := &TreeEntry{}
355
356 path, err := binary.ReadUntil(d.r, '\x00')
357 if err != nil {
358 return nil, err
359 }
360
361 e.Path = string(path)
362
363 count, err := binary.ReadUntil(d.r, ' ')
364 if err != nil {
365 return nil, err
366 }
367
368 i, err := strconv.Atoi(string(count))
369 if err != nil {
370 return nil, err
371 }
372
373 // An entry can be in an invalidated state and is represented by having a
374 // negative number in the entry_count field.
375 if i == -1 {
376 return nil, nil
377 }
378
379 e.Entries = i
380 trees, err := binary.ReadUntil(d.r, '\n')
381 if err != nil {
382 return nil, err
383 }
384
385 i, err = strconv.Atoi(string(trees))
386 if err != nil {
387 return nil, err
388 }
389
390 e.Trees = i
391 _, err = io.ReadFull(d.r, e.Hash[:])
392 if err != nil {
393 return nil, err
394 }
395 return e, nil
396}
397
398type resolveUndoDecoder struct {
399 r *bufio.Reader

Callers 1

DecodeMethod · 0.95

Calls 1

ReadUntilFunction · 0.92

Tested by

no test coverage detected