MCPcopy
hub / github.com/git-lfs/git-lfs / ResolveRef

Function ResolveRef

git/git.go:341–364  ·  view source on GitHub ↗
(ref string)

Source from the content-addressed store, hash-verified

339}
340
341func ResolveRef(ref string) (*Ref, error) {
342 outp, err := gitNoLFSSimple("rev-parse", ref, "--symbolic-full-name", ref)
343 if err != nil {
344 return nil, errors.New(tr.Tr.Get("Git can't resolve ref: %q", ref))
345 }
346 if outp == "" {
347 return nil, errors.New(tr.Tr.Get("Git can't resolve ref: %q", ref))
348 }
349
350 lines := strings.Split(outp, "\n")
351 fullref := &Ref{Sha: lines[0]}
352
353 if len(lines) == 1 {
354 // ref is a sha1 and has no symbolic-full-name
355 fullref.Name = lines[0]
356 fullref.Sha = lines[0]
357 fullref.Type = RefTypeOther
358 return fullref, nil
359 }
360
361 // parse the symbolic-full-name
362 fullref.Type, fullref.Name = ParseRefToTypeAndName(lines[1])
363 return fullref, nil
364}
365
366func ResolveRefs(refnames []string) ([]*Ref, error) {
367 refs := make([]*Ref, len(refnames))

Callers 9

checkoutConflictFunction · 0.92
includeExcludeRefsFunction · 0.92
lfsPushRefsFunction · 0.92
updateOneRefMethod · 0.92
ResolveRefsFunction · 0.85
CurrentRefFunction · 0.85
CurrentRemoteRefMethod · 0.85
parseRefFileFunction · 0.85

Calls 4

NewFunction · 0.92
gitNoLFSSimpleFunction · 0.85
ParseRefToTypeAndNameFunction · 0.85
GetMethod · 0.65

Tested by 1