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

Method TestPullUpdateReferencesIfNeeded

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

Source from the content-addressed store, hash-verified

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