MCPcopy Create free account
hub / github.com/go-git/go-git / TestPushContext

Method TestPushContext

repository_test.go:1671–1691  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

1669}
1670
1671func (s *RepositorySuite) TestPushContext(c *C) {
1672 url, clean := s.TemporalDir()
1673 defer clean()
1674
1675 _, err := PlainInit(url, true)
1676 c.Assert(err, IsNil)
1677
1678 _, err = s.Repository.CreateRemote(&config.RemoteConfig{
1679 Name: "foo",
1680 URLs: []string{url},
1681 })
1682 c.Assert(err, IsNil)
1683
1684 ctx, cancel := context.WithCancel(context.Background())
1685 cancel()
1686
1687 err = s.Repository.PushContext(ctx, &PushOptions{
1688 RemoteName: "foo",
1689 })
1690 c.Assert(err, NotNil)
1691}
1692
1693// installPreReceiveHook installs a pre-receive hook in the .git
1694// directory at path which prints message m before exiting

Callers

nothing calls this directly

Calls 4

PlainInitFunction · 0.85
TemporalDirMethod · 0.80
CreateRemoteMethod · 0.80
PushContextMethod · 0.45

Tested by

no test coverage detected