(c *C)
| 3302 | } |
| 3303 | |
| 3304 | func (s *RepositorySuite) TestBrokenMultipleShallowFetch(c *C) { |
| 3305 | r, _ := Init(memory.NewStorage(), nil) |
| 3306 | _, err := r.CreateRemote(&config.RemoteConfig{ |
| 3307 | Name: DefaultRemoteName, |
| 3308 | URLs: []string{s.GetBasicLocalRepositoryURL()}, |
| 3309 | }) |
| 3310 | c.Assert(err, IsNil) |
| 3311 | |
| 3312 | c.Assert(r.Fetch(&FetchOptions{ |
| 3313 | Depth: 2, |
| 3314 | RefSpecs: []config.RefSpec{config.RefSpec("refs/heads/master:refs/heads/master")}, |
| 3315 | }), IsNil) |
| 3316 | |
| 3317 | shallows, err := r.Storer.Shallow() |
| 3318 | c.Assert(err, IsNil) |
| 3319 | c.Assert(len(shallows), Equals, 1) |
| 3320 | |
| 3321 | ref, err := r.Reference("refs/heads/master", true) |
| 3322 | c.Assert(err, IsNil) |
| 3323 | cobj, err := r.CommitObject(ref.Hash()) |
| 3324 | c.Assert(err, IsNil) |
| 3325 | c.Assert(cobj, NotNil) |
| 3326 | err = object.NewCommitPreorderIter(cobj, nil, nil).ForEach(func(c *object.Commit) error { |
| 3327 | for _, ph := range c.ParentHashes { |
| 3328 | for _, h := range shallows { |
| 3329 | if ph == h { |
| 3330 | return storer.ErrStop |
| 3331 | } |
| 3332 | } |
| 3333 | } |
| 3334 | |
| 3335 | return nil |
| 3336 | }) |
| 3337 | c.Assert(err, IsNil) |
| 3338 | |
| 3339 | c.Assert(r.Fetch(&FetchOptions{ |
| 3340 | Depth: 5, |
| 3341 | RefSpecs: []config.RefSpec{config.RefSpec("refs/heads/*:refs/heads/*")}, |
| 3342 | }), IsNil) |
| 3343 | |
| 3344 | shallows, err = r.Storer.Shallow() |
| 3345 | c.Assert(err, IsNil) |
| 3346 | c.Assert(len(shallows), Equals, 3) |
| 3347 | |
| 3348 | ref, err = r.Reference("refs/heads/master", true) |
| 3349 | c.Assert(err, IsNil) |
| 3350 | cobj, err = r.CommitObject(ref.Hash()) |
| 3351 | c.Assert(err, IsNil) |
| 3352 | c.Assert(cobj, NotNil) |
| 3353 | err = object.NewCommitPreorderIter(cobj, nil, nil).ForEach(func(c *object.Commit) error { |
| 3354 | for _, ph := range c.ParentHashes { |
| 3355 | for _, h := range shallows { |
| 3356 | if ph == h { |
| 3357 | return storer.ErrStop |
| 3358 | } |
| 3359 | } |
| 3360 | } |
| 3361 |
nothing calls this directly
no test coverage detected