aboutsummaryrefslogtreecommitdiffstats
path: root/config/refspec_test.go
diff options
context:
space:
mode:
authorOri Rawlings <orirawlings@gmail.com>2018-03-14 18:27:36 -0500
committerGitHub <noreply@github.com>2018-03-14 18:27:36 -0500
commita39fae69325f5a1faf8fe1b512124f3b77e8612d (patch)
tree37b8a887a981adca776a1d899afb2cf01b759191 /config/refspec_test.go
parent71e37414308043c18b9263ea8b18f296345b3e54 (diff)
parent87b70781ab9ff69811999396d76ca7dfdf6de24b (diff)
downloadgo-git-a39fae69325f5a1faf8fe1b512124f3b77e8612d.tar.gz
Merge pull request #783 from maguro/refspec-src
Fix RefSpec.Src()
Diffstat (limited to 'config/refspec_test.go')
-rw-r--r--config/refspec_test.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/config/refspec_test.go b/config/refspec_test.go
index 5ee6108..675e075 100644
--- a/config/refspec_test.go
+++ b/config/refspec_test.go
@@ -62,8 +62,17 @@ func (s *RefSpecSuite) TestRefSpecSrc(c *C) {
spec := RefSpec("refs/heads/*:refs/remotes/origin/*")
c.Assert(spec.Src(), Equals, "refs/heads/*")
+ spec = RefSpec("+refs/heads/*:refs/remotes/origin/*")
+ c.Assert(spec.Src(), Equals, "refs/heads/*")
+
spec = RefSpec(":refs/heads/master")
c.Assert(spec.Src(), Equals, "")
+
+ spec = RefSpec("refs/heads/love+hate:refs/heads/love+hate")
+ c.Assert(spec.Src(), Equals, "refs/heads/love+hate")
+
+ spec = RefSpec("+refs/heads/love+hate:refs/heads/love+hate")
+ c.Assert(spec.Src(), Equals, "refs/heads/love+hate")
}
func (s *RefSpecSuite) TestRefSpecMatch(c *C) {
@@ -71,9 +80,19 @@ func (s *RefSpecSuite) TestRefSpecMatch(c *C) {
c.Assert(spec.Match(plumbing.ReferenceName("refs/heads/foo")), Equals, false)
c.Assert(spec.Match(plumbing.ReferenceName("refs/heads/master")), Equals, true)
+ spec = RefSpec("+refs/heads/master:refs/remotes/origin/master")
+ c.Assert(spec.Match(plumbing.ReferenceName("refs/heads/foo")), Equals, false)
+ c.Assert(spec.Match(plumbing.ReferenceName("refs/heads/master")), Equals, true)
+
spec = RefSpec(":refs/heads/master")
c.Assert(spec.Match(plumbing.ReferenceName("")), Equals, true)
c.Assert(spec.Match(plumbing.ReferenceName("refs/heads/master")), Equals, false)
+
+ spec = RefSpec("refs/heads/love+hate:heads/love+hate")
+ c.Assert(spec.Match(plumbing.ReferenceName("refs/heads/love+hate")), Equals, true)
+
+ spec = RefSpec("+refs/heads/love+hate:heads/love+hate")
+ c.Assert(spec.Match(plumbing.ReferenceName("refs/heads/love+hate")), Equals, true)
}
func (s *RefSpecSuite) TestRefSpecMatchGlob(c *C) {