aboutsummaryrefslogtreecommitdiffstats
path: root/repository_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'repository_test.go')
-rw-r--r--repository_test.go41
1 files changed, 41 insertions, 0 deletions
diff --git a/repository_test.go b/repository_test.go
index 2c1d4a2..6a9c14a 100644
--- a/repository_test.go
+++ b/repository_test.go
@@ -293,6 +293,25 @@ func (s *RepositorySuite) TestPlainClone(c *C) {
c.Assert(remotes, HasLen, 1)
}
+func (s *RepositorySuite) TestPlainCloneWithRecurseSubmodules(c *C) {
+ dir, err := ioutil.TempDir("", "plain-clone-submodule")
+ c.Assert(err, IsNil)
+ defer os.RemoveAll(dir)
+
+ path := fixtures.ByTag("submodule").One().Worktree().Base()
+
+ r, err := PlainClone(dir, false, &CloneOptions{
+ URL: fmt.Sprintf("file://%s", path),
+ RecurseSubmodules: DefaultRecursivity,
+ })
+
+ c.Assert(err, IsNil)
+
+ cfg, err := r.Config()
+ c.Assert(cfg.Remotes, HasLen, 1)
+ c.Assert(cfg.Submodules, HasLen, 2)
+}
+
func (s *RepositorySuite) TestFetch(c *C) {
r, _ := Init(memory.NewStorage(), nil)
_, err := r.CreateRemote(&config.RemoteConfig{
@@ -562,6 +581,28 @@ func (s *RepositorySuite) TestPullProgress(c *C) {
c.Assert(buf.Len(), Not(Equals), 0)
}
+func (s *RepositorySuite) TestPullProgressWithRecursion(c *C) {
+ path := fixtures.ByTag("submodule").One().Worktree().Base()
+
+ dir, err := ioutil.TempDir("", "plain-clone-submodule")
+ c.Assert(err, IsNil)
+ defer os.RemoveAll(dir)
+
+ r, _ := PlainInit(dir, false)
+ r.CreateRemote(&config.RemoteConfig{
+ Name: DefaultRemoteName,
+ URL: fmt.Sprintf("file://%s", path),
+ })
+
+ err = r.Pull(&PullOptions{
+ RecurseSubmodules: DefaultRecursivity,
+ })
+ c.Assert(err, IsNil)
+
+ cfg, err := r.Config()
+ c.Assert(cfg.Submodules, HasLen, 2)
+}
+
func (s *RepositorySuite) TestPullAdd(c *C) {
path := fixtures.Basic().ByTag("worktree").One().Worktree().Base()