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

Method TestPullAdd

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

Source from the content-addressed store, hash-verified

248}
249
250func (s *RepositorySuite) TestPullAdd(c *C) {
251 path := fixtures.Basic().ByTag("worktree").One().Worktree().Root()
252
253 r, err := Clone(memory.NewStorage(), memfs.New(), &CloneOptions{
254 URL: filepath.Join(path, ".git"),
255 })
256
257 c.Assert(err, IsNil)
258
259 storage := r.Storer.(*memory.Storage)
260 c.Assert(storage.Objects, HasLen, 28)
261
262 branch, err := r.Reference("refs/heads/master", false)
263 c.Assert(err, IsNil)
264 c.Assert(branch.Hash().String(), Equals, "6ecf0ef2c2dffb796033e5a02219af86ec6584e5")
265
266 ExecuteOnPath(c, path,
267 "touch foo",
268 "git add foo",
269 "git commit --no-gpg-sign -m foo foo",
270 )
271
272 w, err := r.Worktree()
273 c.Assert(err, IsNil)
274
275 err = w.Pull(&PullOptions{RemoteName: "origin"})
276 c.Assert(err, IsNil)
277
278 // the commit command has introduced a new commit, tree and blob
279 c.Assert(storage.Objects, HasLen, 31)
280
281 branch, err = r.Reference("refs/heads/master", false)
282 c.Assert(err, IsNil)
283 c.Assert(branch.Hash().String(), Not(Equals), "6ecf0ef2c2dffb796033e5a02219af86ec6584e5")
284}
285
286func (s *WorktreeSuite) TestPullAlreadyUptodate(c *C) {
287 path := fixtures.Basic().ByTag("worktree").One().Worktree().Root()

Callers

nothing calls this directly

Calls 10

NewStorageFunction · 0.92
CloneFunction · 0.85
ExecuteOnPathFunction · 0.85
RootMethod · 0.80
WorktreeMethod · 0.80
JoinMethod · 0.80
PullMethod · 0.80
ReferenceMethod · 0.65
StringMethod · 0.65
HashMethod · 0.65

Tested by

no test coverage detected