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

Method TestPullUpdateReferencesIfNeeded

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

Source from the content-addressed store, hash-verified

144}
145
146func (s *WorktreeSuite) TestPullUpdateReferencesIfNeeded(c *C) {
147 r, _ := Init(memory.NewStorage(), memfs.New())
148 r.CreateRemote(&config.RemoteConfig{
149 Name: DefaultRemoteName,
150 URLs: []string{s.GetBasicLocalRepositoryURL()},
151 })
152
153 err := r.Fetch(&FetchOptions{})
154 c.Assert(err, IsNil)
155
156 _, err = r.Reference("refs/heads/master", false)
157 c.Assert(err, NotNil)
158
159 w, err := r.Worktree()
160 c.Assert(err, IsNil)
161
162 err = w.Pull(&PullOptions{})
163 c.Assert(err, IsNil)
164
165 head, err := r.Reference(plumbing.HEAD, true)
166 c.Assert(err, IsNil)
167 c.Assert(head.Hash().String(), Equals, "6ecf0ef2c2dffb796033e5a02219af86ec6584e5")
168
169 branch, err := r.Reference("refs/heads/master", false)
170 c.Assert(err, IsNil)
171 c.Assert(branch.Hash().String(), Equals, "6ecf0ef2c2dffb796033e5a02219af86ec6584e5")
172
173 err = w.Pull(&PullOptions{})
174 c.Assert(err, Equals, NoErrAlreadyUpToDate)
175}
176
177func (s *WorktreeSuite) TestPullInSingleBranch(c *C) {
178 r, _ := Init(memory.NewStorage(), memfs.New())

Callers

nothing calls this directly

Calls 10

NewStorageFunction · 0.92
InitFunction · 0.85
CreateRemoteMethod · 0.80
WorktreeMethod · 0.80
PullMethod · 0.80
ReferenceMethod · 0.65
StringMethod · 0.65
HashMethod · 0.65
FetchMethod · 0.45

Tested by

no test coverage detected