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

Method TestPushContext

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

Source from the content-addressed store, hash-verified

601}
602
603func (s *RemoteSuite) TestPushContext(c *C) {
604 url := c.MkDir()
605
606 _, err := PlainInit(url, true)
607 c.Assert(err, IsNil)
608
609 fs := fixtures.ByURL("https://github.com/git-fixtures/tags.git").One().DotGit()
610 sto := filesystem.NewStorage(fs, cache.NewObjectLRUDefault())
611
612 r := NewRemote(sto, &config.RemoteConfig{
613 Name: DefaultRemoteName,
614 URLs: []string{url},
615 })
616
617 ctx, cancel := context.WithCancel(context.Background())
618 defer cancel()
619
620 numGoroutines := runtime.NumGoroutine()
621
622 err = r.PushContext(ctx, &PushOptions{
623 RefSpecs: []config.RefSpec{"refs/tags/*:refs/tags/*"},
624 })
625 c.Assert(err, IsNil)
626
627 eventually(c, func() bool {
628 return runtime.NumGoroutine() <= numGoroutines
629 })
630}
631
632func eventually(c *C, condition func() bool) {
633 select {

Callers

nothing calls this directly

Calls 6

PushContextMethod · 0.95
NewStorageFunction · 0.92
NewObjectLRUDefaultFunction · 0.92
PlainInitFunction · 0.85
NewRemoteFunction · 0.85
eventuallyFunction · 0.85

Tested by

no test coverage detected