(rd io.Reader, name string)
| 663 | } |
| 664 | |
| 665 | func (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 |
no test coverage detected