@@ -23,6 +23,15 @@ func (s *RefSpecSuite) TestRefSpecIsValid(c *C) {
2323	spec  =  RefSpec ("refs/heads/master:refs/remotes/origin/master" )
2424	c .Assert (spec .IsValid (), Equals , true )
2525
26+ 	spec  =  RefSpec (":refs/heads/master" )
27+ 	c .Assert (spec .IsValid (), Equals , true )
28+ 
29+ 	spec  =  RefSpec (":refs/heads/*" )
30+ 	c .Assert (spec .IsValid (), Equals , false )
31+ 
32+ 	spec  =  RefSpec (":*" )
33+ 	c .Assert (spec .IsValid (), Equals , false )
34+ 
2635	spec  =  RefSpec ("refs/heads/*" )
2736	c .Assert (spec .IsValid (), Equals , false )
2837}
@@ -35,18 +44,36 @@ func (s *RefSpecSuite) TestRefSpecIsForceUpdate(c *C) {
3544	c .Assert (spec .IsForceUpdate (), Equals , false )
3645}
3746
47+ func  (s  * RefSpecSuite ) TestRefSpecIsDelete (c  * C ) {
48+ 	spec  :=  RefSpec (":refs/heads/master" )
49+ 	c .Assert (spec .IsDelete (), Equals , true )
50+ 
51+ 	spec  =  RefSpec ("+refs/heads/*:refs/remotes/origin/*" )
52+ 	c .Assert (spec .IsDelete (), Equals , false )
53+ 
54+ 	spec  =  RefSpec ("refs/heads/*:refs/remotes/origin/*" )
55+ 	c .Assert (spec .IsDelete (), Equals , false )
56+ }
57+ 
3858func  (s  * RefSpecSuite ) TestRefSpecSrc (c  * C ) {
3959	spec  :=  RefSpec ("refs/heads/*:refs/remotes/origin/*" )
4060	c .Assert (spec .Src (), Equals , "refs/heads/*" )
61+ 
62+ 	spec  =  RefSpec (":refs/heads/master" )
63+ 	c .Assert (spec .Src (), Equals , "" )
4164}
4265
4366func  (s  * RefSpecSuite ) TestRefSpecMatch (c  * C ) {
4467	spec  :=  RefSpec ("refs/heads/master:refs/remotes/origin/master" )
4568	c .Assert (spec .Match (plumbing .ReferenceName ("refs/heads/foo" )), Equals , false )
4669	c .Assert (spec .Match (plumbing .ReferenceName ("refs/heads/master" )), Equals , true )
70+ 
71+ 	spec  =  RefSpec (":refs/heads/master" )
72+ 	c .Assert (spec .Match (plumbing .ReferenceName ("" )), Equals , true )
73+ 	c .Assert (spec .Match (plumbing .ReferenceName ("refs/heads/master" )), Equals , false )
4774}
4875
49- func  (s  * RefSpecSuite ) TestRefSpecMatchBlob (c  * C ) {
76+ func  (s  * RefSpecSuite ) TestRefSpecMatchGlob (c  * C ) {
5077	spec  :=  RefSpec ("refs/heads/*:refs/remotes/origin/*" )
5178	c .Assert (spec .Match (plumbing .ReferenceName ("refs/tag/foo" )), Equals , false )
5279	c .Assert (spec .Match (plumbing .ReferenceName ("refs/heads/foo" )), Equals , true )
0 commit comments