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

Method TestPushDepth

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

Source from the content-addressed store, hash-verified

1708}
1709
1710func (s *RepositorySuite) TestPushDepth(c *C) {
1711 url := c.MkDir()
1712
1713 server, err := PlainClone(url, true, &CloneOptions{
1714 URL: fixtures.Basic().One().DotGit().Root(),
1715 })
1716
1717 c.Assert(err, IsNil)
1718
1719 r, err := Clone(memory.NewStorage(), memfs.New(), &CloneOptions{
1720 URL: url,
1721 Depth: 1,
1722 })
1723 c.Assert(err, IsNil)
1724
1725 err = util.WriteFile(r.wt, "foo", nil, 0755)
1726 c.Assert(err, IsNil)
1727
1728 w, err := r.Worktree()
1729 c.Assert(err, IsNil)
1730
1731 _, err = w.Add("foo")
1732 c.Assert(err, IsNil)
1733
1734 hash, err := w.Commit("foo", &CommitOptions{
1735 Author: defaultSignature(),
1736 Committer: defaultSignature(),
1737 })
1738 c.Assert(err, IsNil)
1739
1740 err = r.Push(&PushOptions{})
1741 c.Assert(err, IsNil)
1742
1743 AssertReferences(c, server, map[string]string{
1744 "refs/heads/master": hash.String(),
1745 })
1746
1747 AssertReferences(c, r, map[string]string{
1748 "refs/remotes/origin/master": hash.String(),
1749 })
1750}
1751
1752func (s *RepositorySuite) TestPushNonExistentRemote(c *C) {
1753 srcFs := fixtures.Basic().One().DotGit()

Callers

nothing calls this directly

Calls 11

NewStorageFunction · 0.92
PlainCloneFunction · 0.85
CloneFunction · 0.85
defaultSignatureFunction · 0.85
AssertReferencesFunction · 0.85
RootMethod · 0.80
WorktreeMethod · 0.80
CommitMethod · 0.65
PushMethod · 0.65
StringMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected