(c *C)
| 376 | } |
| 377 | |
| 378 | func (s *RemoteSuite) TestFetchWithPackfileWriter(c *C) { |
| 379 | fs, clean := s.TemporalFilesystem() |
| 380 | defer clean() |
| 381 | |
| 382 | fss := filesystem.NewStorage(fs, cache.NewObjectLRUDefault()) |
| 383 | mock := &mockPackfileWriter{Storer: fss} |
| 384 | |
| 385 | url := s.GetBasicLocalRepositoryURL() |
| 386 | r := NewRemote(mock, &config.RemoteConfig{Name: "foo", URLs: []string{url}}) |
| 387 | |
| 388 | refspec := config.RefSpec("+refs/heads/*:refs/remotes/origin/*") |
| 389 | err := r.Fetch(&FetchOptions{ |
| 390 | RefSpecs: []config.RefSpec{refspec}, |
| 391 | }) |
| 392 | |
| 393 | c.Assert(err, IsNil) |
| 394 | |
| 395 | var count int |
| 396 | iter, err := mock.IterEncodedObjects(plumbing.AnyObject) |
| 397 | c.Assert(err, IsNil) |
| 398 | |
| 399 | iter.ForEach(func(plumbing.EncodedObject) error { |
| 400 | count++ |
| 401 | return nil |
| 402 | }) |
| 403 | |
| 404 | c.Assert(count, Equals, 31) |
| 405 | c.Assert(mock.PackfileWriterCalled, Equals, true) |
| 406 | } |
| 407 | |
| 408 | func (s *RemoteSuite) TestFetchNoErrAlreadyUpToDate(c *C) { |
| 409 | url := s.GetBasicLocalRepositoryURL() |
nothing calls this directly
no test coverage detected