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

Method TestPullFastForward

worktree_test.go:73–107  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

71}
72
73func (s *WorktreeSuite) TestPullFastForward(c *C) {
74 url := c.MkDir()
75
76 path := fixtures.Basic().ByTag("worktree").One().Worktree().Root()
77
78 server, err := PlainClone(url, false, &CloneOptions{
79 URL: path,
80 })
81 c.Assert(err, IsNil)
82
83 dir := c.MkDir()
84
85 r, err := PlainClone(dir, false, &CloneOptions{
86 URL: url,
87 })
88 c.Assert(err, IsNil)
89
90 w, err := server.Worktree()
91 c.Assert(err, IsNil)
92 err = os.WriteFile(filepath.Join(url, "foo"), []byte("foo"), 0755)
93 c.Assert(err, IsNil)
94 w.Add("foo")
95 hash, err := w.Commit("foo", &CommitOptions{Author: defaultSignature()})
96 c.Assert(err, IsNil)
97
98 w, err = r.Worktree()
99 c.Assert(err, IsNil)
100
101 err = w.Pull(&PullOptions{})
102 c.Assert(err, IsNil)
103
104 head, err := r.Head()
105 c.Assert(err, IsNil)
106 c.Assert(head.Hash(), Equals, hash)
107}
108
109func (s *WorktreeSuite) TestPullNonFastForward(c *C) {
110 url := c.MkDir()

Callers

nothing calls this directly

Calls 10

PlainCloneFunction · 0.85
defaultSignatureFunction · 0.85
RootMethod · 0.80
WorktreeMethod · 0.80
JoinMethod · 0.80
PullMethod · 0.80
HeadMethod · 0.80
CommitMethod · 0.65
HashMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected