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

Method TestPushDepth

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

Source from the content-addressed store, hash-verified

1739}
1740
1741func (s *RepositorySuite) TestPushDepth(c *C) {
1742 url, clean := s.TemporalDir()
1743 defer clean()
1744
1745 server, err := PlainClone(url, true, &CloneOptions{
1746 URL: fixtures.Basic().One().DotGit().Root(),
1747 })
1748
1749 c.Assert(err, IsNil)
1750
1751 r, err := Clone(memory.NewStorage(), memfs.New(), &CloneOptions{
1752 URL: url,
1753 Depth: 1,
1754 })
1755 c.Assert(err, IsNil)
1756
1757 err = util.WriteFile(r.wt, "foo", nil, 0755)
1758 c.Assert(err, IsNil)
1759
1760 w, err := r.Worktree()
1761 c.Assert(err, IsNil)
1762
1763 _, err = w.Add("foo")
1764 c.Assert(err, IsNil)
1765
1766 hash, err := w.Commit("foo", &CommitOptions{
1767 Author: defaultSignature(),
1768 Committer: defaultSignature(),
1769 })
1770 c.Assert(err, IsNil)
1771
1772 err = r.Push(&PushOptions{})
1773 c.Assert(err, IsNil)
1774
1775 AssertReferences(c, server, map[string]string{
1776 "refs/heads/master": hash.String(),
1777 })
1778
1779 AssertReferences(c, r, map[string]string{
1780 "refs/remotes/origin/master": hash.String(),
1781 })
1782}
1783
1784func (s *RepositorySuite) TestPushNonExistentRemote(c *C) {
1785 srcFs := fixtures.Basic().One().DotGit()

Callers

nothing calls this directly

Calls 12

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

Tested by

no test coverage detected