aboutsummaryrefslogtreecommitdiffstats
path: root/config/refspec_test.go
diff options
context:
space:
mode:
authorAlan Cabrera <adc@toolazydogs.com>2018-03-14 07:58:13 -0700
committerAlan Cabrera <acabrera@nianticlabs.com>2018-03-14 08:06:44 -0700
commitd873056e03f21724f799824e02a17b2da7fd29af (patch)
tree5230fc30372b4f0414509b473b281cecbac6204d /config/refspec_test.go
parentecda5c1512bcb19e1802d629b18872ec995e23cf (diff)
downloadgo-git-d873056e03f21724f799824e02a17b2da7fd29af.tar.gz
Fix RefSpec.Src()
Previously, the Src() function was assuming there are no “+” characters in the refspec src and erroneously used the strings.Index() function to compute the start index of src in the refspec. This change now uses the IsForceUpdate() method to decide how to elide the force update token. Signed-off-by: Alan Cabrera <adc@toolazydogs.com>
Diffstat (limited to 'config/refspec_test.go')
-rw-r--r--config/refspec_test.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/config/refspec_test.go b/config/refspec_test.go
index 5ee6108..6daddb4 100644
--- a/config/refspec_test.go
+++ b/config/refspec_test.go
@@ -64,6 +64,9 @@ func (s *RefSpecSuite) TestRefSpecSrc(c *C) {
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")
}
func (s *RefSpecSuite) TestRefSpecMatch(c *C) {
@@ -74,6 +77,9 @@ func (s *RefSpecSuite) TestRefSpecMatch(c *C) {
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)
}
func (s *RefSpecSuite) TestRefSpecMatchGlob(c *C) {