MCPcopy Create free account
hub / github.com/go-git/go-git / TestRefSpecMatch

Method TestRefSpecMatch

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

Source from the content-addressed store, hash-verified

90}
91
92func (s *RefSpecSuite) TestRefSpecMatch(c *C) {
93 spec := RefSpec("refs/heads/master:refs/remotes/origin/master")
94 c.Assert(spec.Match(plumbing.ReferenceName("refs/heads/foo")), Equals, false)
95 c.Assert(spec.Match(plumbing.ReferenceName("refs/heads/master")), Equals, true)
96
97 spec = RefSpec("+refs/heads/master:refs/remotes/origin/master")
98 c.Assert(spec.Match(plumbing.ReferenceName("refs/heads/foo")), Equals, false)
99 c.Assert(spec.Match(plumbing.ReferenceName("refs/heads/master")), Equals, true)
100
101 spec = RefSpec(":refs/heads/master")
102 c.Assert(spec.Match(plumbing.ReferenceName("")), Equals, true)
103 c.Assert(spec.Match(plumbing.ReferenceName("refs/heads/master")), Equals, false)
104
105 spec = RefSpec("refs/heads/love+hate:heads/love+hate")
106 c.Assert(spec.Match(plumbing.ReferenceName("refs/heads/love+hate")), Equals, true)
107
108 spec = RefSpec("+refs/heads/love+hate:heads/love+hate")
109 c.Assert(spec.Match(plumbing.ReferenceName("refs/heads/love+hate")), Equals, true)
110}
111
112func (s *RefSpecSuite) TestRefSpecMatchGlob(c *C) {
113 tests := map[string]map[string]bool{

Callers

nothing calls this directly

Calls 3

ReferenceNameTypeAlias · 0.92
RefSpecTypeAlias · 0.85
MatchMethod · 0.65

Tested by

no test coverage detected