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

Method TestPullFastForward

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 10

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

Tested by

no test coverage detected