diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-06-18 12:15:40 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2017-06-18 12:15:40 +0200 |
commit | abb9ec0f3efea571b7f19b7391eb7c152c899f45 (patch) | |
tree | 703bcd8caf958007e90d6694e5225084b3ddfdb5 /submodule.go | |
parent | bf3a92052f715c507ace0cb9f2b7fb358f623abc (diff) | |
download | go-git-abb9ec0f3efea571b7f19b7391eb7c152c899f45.tar.gz |
*: upgrade to go-billy.v3, merge
Diffstat (limited to 'submodule.go')
-rw-r--r-- | submodule.go | 12 |
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) } |