@@ -1256,8 +1256,18 @@ func (s *RepositorySuite) TestLogAll(c *C) {
12561256 err := r .clone (context .Background (), & CloneOptions {
12571257 URL : s .GetBasicLocalRepositoryURL (),
12581258 })
1259+ c .Assert (err , IsNil )
1260+
1261+ rIter , err := r .Storer .IterReferences ()
1262+ c .Assert (err , IsNil )
12591263
1264+ refCount := 0
1265+ err = rIter .ForEach (func (ref * plumbing.Reference ) error {
1266+ refCount ++
1267+ return nil
1268+ })
12601269 c .Assert (err , IsNil )
1270+ c .Assert (refCount , Equals , 5 )
12611271
12621272 cIter , err := r .Log (& LogOptions {
12631273 All : true ,
@@ -1286,6 +1296,58 @@ func (s *RepositorySuite) TestLogAll(c *C) {
12861296 cIter .Close ()
12871297}
12881298
1299+ func (s * RepositorySuite ) TestLogAllMissingReferences (c * C ) {
1300+ r , _ := Init (memory .NewStorage (), nil )
1301+ err := r .clone (context .Background (), & CloneOptions {
1302+ URL : s .GetBasicLocalRepositoryURL (),
1303+ })
1304+ c .Assert (err , IsNil )
1305+ err = r .Storer .RemoveReference (plumbing .HEAD )
1306+ c .Assert (err , IsNil )
1307+
1308+ rIter , err := r .Storer .IterReferences ()
1309+ c .Assert (err , IsNil )
1310+
1311+ refCount := 0
1312+ err = rIter .ForEach (func (ref * plumbing.Reference ) error {
1313+ refCount ++
1314+ return nil
1315+ })
1316+ c .Assert (err , IsNil )
1317+ c .Assert (refCount , Equals , 4 )
1318+
1319+ err = r .Storer .SetReference (plumbing .NewHashReference (plumbing .ReferenceName ("DUMMY" ), plumbing .NewHash ("DUMMY" )))
1320+ c .Assert (err , IsNil )
1321+
1322+ rIter , err = r .Storer .IterReferences ()
1323+ c .Assert (err , IsNil )
1324+
1325+ refCount = 0
1326+ err = rIter .ForEach (func (ref * plumbing.Reference ) error {
1327+ refCount ++
1328+ return nil
1329+ })
1330+ c .Assert (err , IsNil )
1331+ c .Assert (refCount , Equals , 5 )
1332+
1333+ cIter , err := r .Log (& LogOptions {
1334+ All : true ,
1335+ })
1336+ c .Assert (cIter , NotNil )
1337+ c .Assert (err , IsNil )
1338+
1339+ cCount := 0
1340+ cIter .ForEach (func (c * object.Commit ) error {
1341+ cCount ++
1342+ return nil
1343+ })
1344+ c .Assert (cCount , Equals , 9 )
1345+
1346+ _ , err = cIter .Next ()
1347+ c .Assert (err , Equals , io .EOF )
1348+ cIter .Close ()
1349+ }
1350+
12891351func (s * RepositorySuite ) TestLogAllOrderByTime (c * C ) {
12901352 r , _ := Init (memory .NewStorage (), nil )
12911353 err := r .clone (context .Background (), & CloneOptions {
0 commit comments