MCPcopy
hub / github.com/go-git/go-git / TestFetchOfMissingObjects

Method TestFetchOfMissingObjects

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

Source from the content-addressed store, hash-verified

350}
351
352func (s *RemoteSuite) TestFetchOfMissingObjects(c *C) {
353 tmp := c.MkDir()
354
355 // clone to a local temp folder
356 _, err := PlainClone(tmp, true, &CloneOptions{
357 URL: fixtures.Basic().One().DotGit().Root(),
358 })
359 c.Assert(err, IsNil)
360
361 // Delete the pack files
362 fsTmp := osfs.New(tmp)
363 err = util.RemoveAll(fsTmp, "objects/pack")
364 c.Assert(err, IsNil)
365
366 // Reopen the repo from the filesystem (with missing objects)
367 r, err := Open(filesystem.NewStorage(fsTmp, cache.NewObjectLRUDefault()), nil)
368 c.Assert(err, IsNil)
369
370 // Confirm we are missing a commit
371 _, err = r.CommitObject(plumbing.NewHash("6ecf0ef2c2dffb796033e5a02219af86ec6584e5"))
372 c.Assert(err, Equals, plumbing.ErrObjectNotFound)
373
374 // Refetch to get all the missing objects
375 err = r.Fetch(&FetchOptions{})
376 c.Assert(err, IsNil)
377
378 // Confirm we now have the commit
379 _, err = r.CommitObject(plumbing.NewHash("6ecf0ef2c2dffb796033e5a02219af86ec6584e5"))
380 c.Assert(err, IsNil)
381}
382
383func (s *RemoteSuite) TestFetchWithProgress(c *C) {
384 url := s.GetBasicLocalRepositoryURL()

Callers

nothing calls this directly

Calls 8

NewStorageFunction · 0.92
NewObjectLRUDefaultFunction · 0.92
NewHashFunction · 0.92
PlainCloneFunction · 0.85
OpenFunction · 0.85
RootMethod · 0.80
CommitObjectMethod · 0.80
FetchMethod · 0.45

Tested by

no test coverage detected