aboutsummaryrefslogtreecommitdiffstats
path: root/repository_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-02-14 19:26:32 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2017-02-15 09:30:05 +0100
commitd6a6decd1be0515faf36256ce06c58c7d662bbd0 (patch)
treeb91c4f618470c7cf1ef9547b9146d08e30df6204 /repository_test.go
parent09110d8e6d1ddb6f6a22867dcedeebd8f2262780 (diff)
downloadgo-git-d6a6decd1be0515faf36256ce06c58c7d662bbd0.tar.gz
submodule update implementation
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()