diff options
author | Paulo Gomes <pjbgf@linux.com> | 2023-12-01 09:42:24 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-01 09:42:24 +0000 |
commit | ae552ce0bf32cddb689727c4c9fa6bf4d3bd6499 (patch) | |
tree | c223855c84a1b15db67762f4b53c4093c216e734 /worktree_test.go | |
parent | cc1895b905ebadb09504d88444ff05932fa6e928 (diff) | |
parent | 861009f70a5b68d1ee134fea7bc1d893088388bb (diff) | |
download | go-git-ae552ce0bf32cddb689727c4c9fa6bf4d3bd6499.tar.gz |
Merge pull request #939 from dhoizner/fix-pull-after-shallow
git: stop iterating at oldest shallow when pulling. Fixes #305
Diffstat (limited to 'worktree_test.go')
-rw-r--r-- | worktree_test.go | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/worktree_test.go b/worktree_test.go index 5c9a4eb..3136e59 100644 --- a/worktree_test.go +++ b/worktree_test.go @@ -313,6 +313,42 @@ func (s *WorktreeSuite) TestPullDepth(c *C) { c.Assert(err, Equals, nil) } +func (s *WorktreeSuite) TestPullAfterShallowClone(c *C) { + tempDir, clean := s.TemporalDir() + defer clean() + remoteURL := filepath.Join(tempDir, "remote") + repoDir := filepath.Join(tempDir, "repo") + + remote, err := PlainInit(remoteURL, false) + c.Assert(err, IsNil) + c.Assert(remote, NotNil) + + _ = CommitNewFile(c, remote, "File1") + _ = CommitNewFile(c, remote, "File2") + + repo, err := PlainClone(repoDir, false, &CloneOptions{ + URL: remoteURL, + Depth: 1, + Tags: NoTags, + SingleBranch: true, + ReferenceName: "master", + }) + c.Assert(err, IsNil) + + _ = CommitNewFile(c, remote, "File3") + _ = CommitNewFile(c, remote, "File4") + + w, err := repo.Worktree() + c.Assert(err, IsNil) + + err = w.Pull(&PullOptions{ + RemoteName: DefaultRemoteName, + SingleBranch: true, + ReferenceName: plumbing.NewBranchReferenceName("master"), + }) + c.Assert(err, IsNil) +} + func (s *WorktreeSuite) TestCheckout(c *C) { fs := memfs.New() w := &Worktree{ |