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

Method SetRef

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

Source from the content-addressed store, hash-verified

684}
685
686func (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.

Callers 6

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

Calls 6

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

Tested by 4

testSetRefsFunction · 0.64
TestPackRefsMethod · 0.64
TestDeletedRefsMethod · 0.64