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

Method TestPullAdd

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

Source from the content-addressed store, hash-verified

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