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

Method SetRef

storage/filesystem/dotgit/dotgit.go:708–720  ·  view source on GitHub ↗
(r, old *plumbing.Reference)

Source from the content-addressed store, hash-verified

706}
707
708func (d *DotGit) SetRef(r, old *plumbing.Reference) error {
709 var content string
710 switch r.Type() {
711 case plumbing.SymbolicReference:
712 content = fmt.Sprintf("ref: %s\n", r.Target())
713 case plumbing.HashReference:
714 content = fmt.Sprintln(r.Hash().String())
715 }
716
717 fileName := r.Name().String()
718
719 return d.setRef(fileName, content, old)
720}
721
722// Refs scans the git directory collecting references, which it returns.
723// Symbolic references are resolved and included in the output.

Callers 7

SetReferenceMethod · 0.80
CheckAndSetReferenceMethod · 0.80
testSetRefsFunction · 0.80
TestPackRefsMethod · 0.80
TestDeletedRefsMethod · 0.80
TestSetPackedRefMethod · 0.80

Calls 6

setRefMethod · 0.95
TargetMethod · 0.80
TypeMethod · 0.65
StringMethod · 0.65
HashMethod · 0.65
NameMethod · 0.65

Tested by 5

testSetRefsFunction · 0.64
TestPackRefsMethod · 0.64
TestDeletedRefsMethod · 0.64
TestSetPackedRefMethod · 0.64