aboutsummaryrefslogtreecommitdiffstats
path: root/remote_test.go
diff options
context:
space:
mode:
authorMarcus Watkins <marwatk@marcuswatkins.net>2021-05-12 14:39:49 -0600
committerGitHub <noreply@github.com>2021-05-12 22:39:49 +0200
commit320db9af8ba8b0046e833013504eb07c61a3573c (patch)
treec7b18c36c8f6a146b1e66fc705373f5632853a5f /remote_test.go
parentdb2bc57350561c4368a8d32c42476699b48d2a09 (diff)
downloadgo-git-320db9af8ba8b0046e833013504eb07c61a3573c.tar.gz
git: Add support for deepening shallow clones (#311)
Diffstat (limited to 'remote_test.go')
-rw-r--r--remote_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/remote_test.go b/remote_test.go
index 2cd2a6e..1efc9da 100644
--- a/remote_test.go
+++ b/remote_test.go
@@ -233,6 +233,32 @@ func (s *RemoteSuite) TestFetchWithDepth(c *C) {
c.Assert(r.s.(*memory.Storage).Objects, HasLen, 18)
}
+func (s *RemoteSuite) TestFetchWithDepthChange(c *C) {
+ r := NewRemote(memory.NewStorage(), &config.RemoteConfig{
+ URLs: []string{s.GetBasicLocalRepositoryURL()},
+ })
+
+ s.testFetch(c, r, &FetchOptions{
+ Depth: 1,
+ RefSpecs: []config.RefSpec{
+ config.RefSpec("refs/heads/master:refs/heads/master"),
+ },
+ }, []*plumbing.Reference{
+ plumbing.NewReferenceFromStrings("refs/heads/master", "6ecf0ef2c2dffb796033e5a02219af86ec6584e5"),
+ })
+ c.Assert(r.s.(*memory.Storage).Commits, HasLen, 1)
+
+ s.testFetch(c, r, &FetchOptions{
+ Depth: 3,
+ RefSpecs: []config.RefSpec{
+ config.RefSpec("refs/heads/master:refs/heads/master"),
+ },
+ }, []*plumbing.Reference{
+ plumbing.NewReferenceFromStrings("refs/heads/master", "6ecf0ef2c2dffb796033e5a02219af86ec6584e5"),
+ })
+ c.Assert(r.s.(*memory.Storage).Commits, HasLen, 3)
+}
+
func (s *RemoteSuite) testFetch(c *C, r *Remote, o *FetchOptions, expected []*plumbing.Reference) {
err := r.Fetch(o)
c.Assert(err, IsNil)