aboutsummaryrefslogtreecommitdiffstats
path: root/worktree_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-02-14 00:25:09 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2017-02-14 00:25:09 +0100
commit7e990a811d9e23b5a3573c405b70f06a1be9e7b6 (patch)
tree5cf329829edb41a562319f6242c13e90e350d365 /worktree_test.go
parent65351f835dcaa4b50dd44bce7bf3f2e31582dadc (diff)
downloadgo-git-7e990a811d9e23b5a3573c405b70f06a1be9e7b6.tar.gz
submodule init and update implementation
Diffstat (limited to 'worktree_test.go')
-rw-r--r--worktree_test.go32
1 files changed, 30 insertions, 2 deletions
diff --git a/worktree_test.go b/worktree_test.go
index 306b56d..81d35b1 100644
--- a/worktree_test.go
+++ b/worktree_test.go
@@ -7,6 +7,7 @@ import (
"srcd.works/go-git.v4/plumbing/format/index"
"srcd.works/go-git.v4/plumbing/object"
+ "github.com/src-d/go-git-fixtures"
. "gopkg.in/check.v1"
"srcd.works/go-billy.v1/memfs"
"srcd.works/go-billy.v1/osfs"
@@ -40,7 +41,7 @@ func (s *WorktreeSuite) TestCheckout(c *C) {
entries, err := fs.ReadDir("/")
c.Assert(err, IsNil)
- c.Assert(entries, HasLen, 9)
+ c.Assert(entries, HasLen, 8)
ch, err := fs.Open("CHANGELOG")
c.Assert(err, IsNil)
@@ -116,7 +117,6 @@ func (s *WorktreeSuite) TestCheckoutIndexOS(c *C) {
}
func (s *WorktreeSuite) TestStatus(c *C) {
-
h, err := s.Repository.Head()
c.Assert(err, IsNil)
@@ -164,3 +164,31 @@ func (s *WorktreeSuite) TestStatusModified(c *C) {
c.Assert(err, IsNil)
c.Assert(status.IsClean(), Equals, false)
}
+
+func (s *WorktreeSuite) TestSubmodule(c *C) {
+ path := fixtures.ByTag("submodule").One().Worktree().Base()
+ r, err := PlainOpen(path)
+ c.Assert(err, IsNil)
+
+ w, err := r.Worktree()
+ c.Assert(err, IsNil)
+
+ m, err := w.Submodule("basic")
+ c.Assert(err, IsNil)
+
+ c.Assert(m.Config().Name, Equals, "basic")
+}
+
+func (s *WorktreeSuite) TestSubmodules(c *C) {
+ path := fixtures.ByTag("submodule").One().Worktree().Base()
+ r, err := PlainOpen(path)
+ c.Assert(err, IsNil)
+
+ w, err := r.Worktree()
+ c.Assert(err, IsNil)
+
+ l, err := w.Submodules()
+ c.Assert(err, IsNil)
+
+ c.Assert(l, HasLen, 2)
+}