@@ -85,6 +85,15 @@ func (s *SuiteDotGit) TestSetRefsNorwfs(c *C) {
85
85
testSetRefs (c , dir )
86
86
}
87
87
88
+ func (s * SuiteDotGit ) TestRefsHeadFirst (c * C ) {
89
+ fs := fixtures .Basic ().ByTag (".git" ).One ().DotGit ()
90
+ dir := New (fs )
91
+ refs , err := dir .Refs ()
92
+ c .Assert (err , IsNil )
93
+ c .Assert (len (refs ), Not (Equals ), 0 )
94
+ c .Assert (refs [0 ].Name ().String (), Equals , "HEAD" )
95
+ }
96
+
88
97
func testSetRefs (c * C , dir * DotGit ) {
89
98
firstFoo := plumbing .NewReferenceFromStrings (
90
99
"refs/heads/foo" ,
@@ -175,7 +184,6 @@ func (s *SuiteDotGit) TestRefsFromPackedRefs(c *C) {
175
184
ref := findReference (refs , "refs/remotes/origin/branch" )
176
185
c .Assert (ref , NotNil )
177
186
c .Assert (ref .Hash ().String (), Equals , "e8d3ffab552895c19b9fcf7aa264d277cde33881" )
178
-
179
187
}
180
188
181
189
func (s * SuiteDotGit ) TestRefsFromReferenceFile (c * C ) {
@@ -189,7 +197,6 @@ func (s *SuiteDotGit) TestRefsFromReferenceFile(c *C) {
189
197
c .Assert (ref , NotNil )
190
198
c .Assert (ref .Type (), Equals , plumbing .SymbolicReference )
191
199
c .Assert (string (ref .Target ()), Equals , "refs/remotes/origin/master" )
192
-
193
200
}
194
201
195
202
func BenchmarkRefMultipleTimes (b * testing.B ) {
@@ -538,7 +545,6 @@ func (s *SuiteDotGit) TestObjectPackWithKeepDescriptors(c *C) {
538
545
539
546
err = dir .Close ()
540
547
c .Assert (err , NotNil )
541
-
542
548
}
543
549
544
550
func (s * SuiteDotGit ) TestObjectPackIdx (c * C ) {
@@ -649,7 +655,7 @@ func (s *SuiteDotGit) TestObject(c *C) {
649
655
file .Name (), fs .Join ("objects" , "03" , "db8e1fbe133a480f2867aac478fd866686d69e" )),
650
656
Equals , true ,
651
657
)
652
- incomingHash := "9d25e0f9bde9f82882b49fe29117b9411cb157b7" //made up hash
658
+ incomingHash := "9d25e0f9bde9f82882b49fe29117b9411cb157b7" // made up hash
653
659
incomingDirPath := fs .Join ("objects" , "tmp_objdir-incoming-123456" )
654
660
incomingFilePath := fs .Join (incomingDirPath , incomingHash [0 :2 ], incomingHash [2 :40 ])
655
661
fs .MkdirAll (incomingDirPath , os .FileMode (0755 ))
@@ -670,7 +676,7 @@ func (s *SuiteDotGit) TestPreGit235Object(c *C) {
670
676
file .Name (), fs .Join ("objects" , "03" , "db8e1fbe133a480f2867aac478fd866686d69e" )),
671
677
Equals , true ,
672
678
)
673
- incomingHash := "9d25e0f9bde9f82882b49fe29117b9411cb157b7" //made up hash
679
+ incomingHash := "9d25e0f9bde9f82882b49fe29117b9411cb157b7" // made up hash
674
680
incomingDirPath := fs .Join ("objects" , "incoming-123456" )
675
681
incomingFilePath := fs .Join (incomingDirPath , incomingHash [0 :2 ], incomingHash [2 :40 ])
676
682
fs .MkdirAll (incomingDirPath , os .FileMode (0755 ))
@@ -687,7 +693,7 @@ func (s *SuiteDotGit) TestObjectStat(c *C) {
687
693
hash := plumbing .NewHash ("03db8e1fbe133a480f2867aac478fd866686d69e" )
688
694
_ , err := dir .ObjectStat (hash )
689
695
c .Assert (err , IsNil )
690
- incomingHash := "9d25e0f9bde9f82882b49fe29117b9411cb157b7" //made up hash
696
+ incomingHash := "9d25e0f9bde9f82882b49fe29117b9411cb157b7" // made up hash
691
697
incomingDirPath := fs .Join ("objects" , "tmp_objdir-incoming-123456" )
692
698
incomingFilePath := fs .Join (incomingDirPath , incomingHash [0 :2 ], incomingHash [2 :40 ])
693
699
fs .MkdirAll (incomingDirPath , os .FileMode (0755 ))
@@ -705,7 +711,7 @@ func (s *SuiteDotGit) TestObjectDelete(c *C) {
705
711
err := dir .ObjectDelete (hash )
706
712
c .Assert (err , IsNil )
707
713
708
- incomingHash := "9d25e0f9bde9f82882b49fe29117b9411cb157b7" //made up hash
714
+ incomingHash := "9d25e0f9bde9f82882b49fe29117b9411cb157b7" // made up hash
709
715
incomingDirPath := fs .Join ("objects" , "tmp_objdir-incoming-123456" )
710
716
incomingSubDirPath := fs .Join (incomingDirPath , incomingHash [0 :2 ])
711
717
incomingFilePath := fs .Join (incomingSubDirPath , incomingHash [2 :40 ])
0 commit comments