MCPcopy Index your code
hub / github.com/git-lfs/git-lfs / ParseRef

Function ParseRef

git/git.go:81–101  ·  view source on GitHub ↗
(absRef, sha string)

Source from the content-addressed store, hash-verified

79}
80
81func ParseRef(absRef, sha string) *Ref {
82 r := &Ref{Sha: sha}
83 if strings.HasPrefix(absRef, "refs/heads/") {
84 r.Name = absRef[11:]
85 r.Type = RefTypeLocalBranch
86 } else if strings.HasPrefix(absRef, "refs/tags/") {
87 r.Name = absRef[10:]
88 r.Type = RefTypeLocalTag
89 } else if strings.HasPrefix(absRef, "refs/remotes/") {
90 r.Name = absRef[13:]
91 r.Type = RefTypeRemoteBranch
92 } else {
93 r.Name = absRef
94 if absRef == "HEAD" {
95 r.Type = RefTypeHEAD
96 } else {
97 r.Type = RefTypeOther
98 }
99 }
100 return r
101}
102
103// A git reference (branch, tag etc)
104type Ref struct {

Callers 8

decodeRefsFunction · 0.92
GetAllWorktreesFunction · 0.85
trackingRefFunction · 0.85
TestParseRefsFunction · 0.85
TestRefUpdateDefaultFunction · 0.85

Calls

no outgoing calls

Tested by 5

TestParseRefsFunction · 0.68
TestRefUpdateDefaultFunction · 0.68