MCPcopy Index your code
hub / github.com/go-git/go-git / TestFetchWithPackfileWriter

Method TestFetchWithPackfileWriter

remote_test.go:412–439  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

410}
411
412func (s *RemoteSuite) TestFetchWithPackfileWriter(c *C) {
413 fs := s.TemporalFilesystem(c)
414
415 fss := filesystem.NewStorage(fs, cache.NewObjectLRUDefault())
416 mock := &mockPackfileWriter{Storer: fss}
417
418 url := s.GetBasicLocalRepositoryURL()
419 r := NewRemote(mock, &config.RemoteConfig{Name: "foo", URLs: []string{url}})
420
421 refspec := config.RefSpec("+refs/heads/*:refs/remotes/origin/*")
422 err := r.Fetch(&FetchOptions{
423 RefSpecs: []config.RefSpec{refspec},
424 })
425
426 c.Assert(err, IsNil)
427
428 var count int
429 iter, err := mock.IterEncodedObjects(plumbing.AnyObject)
430 c.Assert(err, IsNil)
431
432 iter.ForEach(func(plumbing.EncodedObject) error {
433 count++
434 return nil
435 })
436
437 c.Assert(count, Equals, 31)
438 c.Assert(mock.PackfileWriterCalled, Equals, true)
439}
440
441func (s *RemoteSuite) TestFetchNoErrAlreadyUpToDate(c *C) {
442 url := s.GetBasicLocalRepositoryURL()

Callers

nothing calls this directly

Calls 9

FetchMethod · 0.95
NewStorageFunction · 0.92
NewObjectLRUDefaultFunction · 0.92
RefSpecTypeAlias · 0.92
NewRemoteFunction · 0.85
IterEncodedObjectsMethod · 0.65
ForEachMethod · 0.65
TemporalFilesystemMethod · 0.45

Tested by

no test coverage detected