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

Method TestRefSpecDstBlob

config/refspec_test.go:155–183  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

153}
154
155func (s *RefSpecSuite) TestRefSpecDstBlob(c *C) {
156 ref := "refs/heads/abc"
157 tests := map[string]string{
158 "refs/heads/*:refs/remotes/origin/*": "refs/remotes/origin/abc",
159 "refs/heads/*bc:refs/remotes/origin/*": "refs/remotes/origin/a",
160 "refs/heads/*bc:refs/remotes/origin/*bc": "refs/remotes/origin/abc",
161 "refs/heads/a*c:refs/remotes/origin/*": "refs/remotes/origin/b",
162 "refs/heads/a*c:refs/remotes/origin/a*c": "refs/remotes/origin/abc",
163 "refs/heads/ab*:refs/remotes/origin/*": "refs/remotes/origin/c",
164 "refs/heads/ab*:refs/remotes/origin/ab*": "refs/remotes/origin/abc",
165 "refs/heads/*abc:refs/remotes/origin/*abc": "refs/remotes/origin/abc",
166 "refs/heads/abc*:refs/remotes/origin/abc*": "refs/remotes/origin/abc",
167 // for these two cases, git specifically logs:
168 // error: * Ignoring funny ref 'refs/remotes/origin/' locally
169 // and ignores the ref; go-git does not currently do this validation,
170 // but probably should.
171 // "refs/heads/*abc:refs/remotes/origin/*": "",
172 // "refs/heads/abc*:refs/remotes/origin/*": "",
173 }
174
175 for specStr, dst := range tests {
176 spec := RefSpec(specStr)
177 c.Assert(spec.Dst(plumbing.ReferenceName(ref)).String(),
178 Equals,
179 dst,
180 Commentf("while getting dst from spec %q with ref %q", specStr, ref),
181 )
182 }
183}
184
185func (s *RefSpecSuite) TestRefSpecReverse(c *C) {
186 spec := RefSpec("refs/heads/*:refs/remotes/origin/*")

Callers

nothing calls this directly

Calls 4

ReferenceNameTypeAlias · 0.92
RefSpecTypeAlias · 0.85
DstMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected