MCPcopy
hub / github.com/go-git/go-git / readReferenceFrom

Method readReferenceFrom

storage/filesystem/dotgit/dotgit.go:665–677  ·  view source on GitHub ↗
(rd io.Reader, name string)

Source from the content-addressed store, hash-verified

663}
664
665func (d *DotGit) readReferenceFrom(rd io.Reader, name string) (ref *plumbing.Reference, err error) {
666 b, err := io.ReadAll(rd)
667 if err != nil {
668 return nil, err
669 }
670
671 if len(b) == 0 {
672 return nil, ErrEmptyRefFile
673 }
674
675 line := strings.TrimSpace(string(b))
676 return plumbing.NewReferenceFromStrings(name, line), nil
677}
678
679// checkReferenceAndTruncate reads the reference from the given file, or the `pack-refs` file if
680// the file was empty. Then it checks that the old reference matches the stored reference and

Callers 3

setRefNorwfsMethod · 0.95
readReferenceFileMethod · 0.95

Calls 1

NewReferenceFromStringsFunction · 0.92

Tested by

no test coverage detected