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

Method Dst

config/refspec.go:117–133  ·  view source on GitHub ↗

Dst returns the destination for the given remote reference.

(n plumbing.ReferenceName)

Source from the content-addressed store, hash-verified

115
116// Dst returns the destination for the given remote reference.
117func (s RefSpec) Dst(n plumbing.ReferenceName) plumbing.ReferenceName {
118 spec := string(s)
119 start := strings.Index(spec, refSpecSeparator) + 1
120 dst := spec[start:]
121 src := s.Src()
122
123 if !s.IsWildcard() {
124 return plumbing.ReferenceName(dst)
125 }
126
127 name := n.String()
128 ws := strings.Index(src, refSpecWildcard)
129 wd := strings.Index(dst, refSpecWildcard)
130 match := name[ws : len(name)-(len(src)-(ws+1))]
131
132 return plumbing.ReferenceName(dst[0:wd] + match + dst[wd+1:])
133}
134
135func (s RefSpec) Reverse() RefSpec {
136 spec := string(s)

Callers 11

pruneRemotesMethod · 0.80
deleteReferencesMethod · 0.80
addCommitMethod · 0.80
doCalculateRefsFunction · 0.80
TestRefSpecDstMethod · 0.80
TestRefSpecDstBlobMethod · 0.80

Calls 5

SrcMethod · 0.95
IsWildcardMethod · 0.95
ReferenceNameTypeAlias · 0.92
IndexMethod · 0.65
StringMethod · 0.65

Tested by 2

TestRefSpecDstMethod · 0.64
TestRefSpecDstBlobMethod · 0.64