aboutsummaryrefslogtreecommitdiffstats
path: root/submodule.go
diff options
context:
space:
mode:
Diffstat (limited to 'submodule.go')
-rw-r--r--submodule.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/submodule.go b/submodule.go
index fd23b9d..572e6f7 100644
--- a/submodule.go
+++ b/submodule.go
@@ -5,6 +5,7 @@ import (
"errors"
"fmt"
+ billy "gopkg.in/src-d/go-billy.v3"
"gopkg.in/src-d/go-git.v4/config"
"gopkg.in/src-d/go-git.v4/plumbing"
"gopkg.in/src-d/go-git.v4/plumbing/format/index"
@@ -107,8 +108,17 @@ func (s *Submodule) Repository() (*Repository, error) {
return nil, err
}
- worktree := s.w.fs.Dir(s.c.Path)
+ var exists bool
if err == nil {
+ exists = true
+ }
+
+ var worktree billy.Filesystem
+ if worktree, err = s.w.fs.Chroot(s.c.Path); err != nil {
+ return nil, err
+ }
+
+ if exists {
return Open(storer, worktree)
}