| 684 | } |
| 685 | |
| 686 | func (d *DotGit) SetRef(r, old *plumbing.Reference) error { |
| 687 | var content string |
| 688 | switch r.Type() { |
| 689 | case plumbing.SymbolicReference: |
| 690 | content = fmt.Sprintf("ref: %s\n", r.Target()) |
| 691 | case plumbing.HashReference: |
| 692 | content = fmt.Sprintln(r.Hash().String()) |
| 693 | } |
| 694 | |
| 695 | fileName := r.Name().String() |
| 696 | |
| 697 | return d.setRef(fileName, content, old) |
| 698 | } |
| 699 | |
| 700 | // Refs scans the git directory collecting references, which it returns. |
| 701 | // Symbolic references are resolved and included in the output. |