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

Method TestPullAfterShallowClone

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

Source from the content-addressed store, hash-verified

321}
322
323func (s *WorktreeSuite) TestPullAfterShallowClone(c *C) {
324 tempDir := c.MkDir()
325 remoteURL := filepath.Join(tempDir, "remote")
326 repoDir := filepath.Join(tempDir, "repo")
327
328 remote, err := PlainInit(remoteURL, false)
329 c.Assert(err, IsNil)
330 c.Assert(remote, NotNil)
331
332 _ = CommitNewFile(c, remote, "File1")
333 _ = CommitNewFile(c, remote, "File2")
334
335 repo, err := PlainClone(repoDir, false, &CloneOptions{
336 URL: remoteURL,
337 Depth: 1,
338 Tags: NoTags,
339 SingleBranch: true,
340 ReferenceName: "master",
341 })
342 c.Assert(err, IsNil)
343
344 _ = CommitNewFile(c, remote, "File3")
345 _ = CommitNewFile(c, remote, "File4")
346
347 w, err := repo.Worktree()
348 c.Assert(err, IsNil)
349
350 err = w.Pull(&PullOptions{
351 RemoteName: DefaultRemoteName,
352 SingleBranch: true,
353 ReferenceName: plumbing.NewBranchReferenceName("master"),
354 })
355 c.Assert(err, IsNil)
356}
357
358func (s *WorktreeSuite) TestCheckout(c *C) {
359 fs := memfs.New()

Callers

nothing calls this directly

Calls 7

NewBranchReferenceNameFunction · 0.92
PlainInitFunction · 0.85
CommitNewFileFunction · 0.85
PlainCloneFunction · 0.85
JoinMethod · 0.80
WorktreeMethod · 0.80
PullMethod · 0.80

Tested by

no test coverage detected