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

Function expand_ref

repository.go:1547–1562  ·  view source on GitHub ↗
(s storer.ReferenceStorer, ref plumbing.ReferenceName)

Source from the content-addressed store, hash-verified

1545}
1546
1547func expand_ref(s storer.ReferenceStorer, ref plumbing.ReferenceName) (*plumbing.Reference, error) {
1548 // For improving troubleshooting, this preserves the error for the provided `ref`,
1549 // and returns the error for that specific ref in case all parse rules fails.
1550 var ret error
1551 for _, rule := range plumbing.RefRevParseRules {
1552 resolvedRef, err := storer.ResolveReference(s, plumbing.ReferenceName(fmt.Sprintf(rule, ref)))
1553
1554 if err == nil {
1555 return resolvedRef, nil
1556 } else if ret == nil {
1557 ret = err
1558 }
1559 }
1560
1561 return nil, ret
1562}
1563
1564// ResolveRevision resolves revision to corresponding hash. It will always
1565// resolve to a commit hash, not a tree or annotated tag.

Callers 3

ResolveRevisionMethod · 0.85
doCalculateRefsFunction · 0.85

Calls 2

ResolveReferenceFunction · 0.92
ReferenceNameTypeAlias · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…