From dbaf42e66abf7679dcab84cdbfefa57cd238ef4e Mon Sep 17 00:00:00 2001 From: Keenan Nemetz Date: Wed, 3 Feb 2021 09:55:26 -0800 Subject: [PATCH] Use empty dir when importing git submodules. --- git/git.go | 4 ++-- git/git_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/git/git.go b/git/git.go index d9d6e13..8722e30 100644 --- a/git/git.go +++ b/git/git.go @@ -3,7 +3,6 @@ package git import ( "context" - "errors" "io/ioutil" "path" "path/filepath" @@ -16,6 +15,7 @@ import ( "github.com/ipfs/go-cid" ipld "github.com/ipfs/go-ipld-format" "github.com/ipfs/go-merkledag" + ufs "github.com/ipfs/go-unixfs" ufsio "github.com/ipfs/go-unixfs/io" "github.com/multiverse-vcs/go-multiverse/data" "github.com/multiverse-vcs/go-multiverse/unixfs" @@ -217,7 +217,7 @@ func (i *importer) AddTreeEntry(entry object.TreeEntry) (ipld.Node, error) { case filemode.Dir: return i.AddTree(entry.Hash) case filemode.Submodule: - return nil, errors.New("submodules not supported") + return ufs.EmptyDirNode(), nil } blob, err := i.repo.BlobObject(entry.Hash) diff --git a/git/git_test.go b/git/git_test.go index 611d631..beb12a8 100644 --- a/git/git_test.go +++ b/git/git_test.go @@ -41,7 +41,7 @@ func TestImportFromFS(t *testing.T) { defer os.RemoveAll(dir) opts := git.CloneOptions{ - URL: "https://github.com/multiverse-vcs/go-multiverse", + URL: "https://github.com/hsoft/collapseos", } _, err = git.PlainClone(dir, false, &opts) @@ -62,4 +62,4 @@ func TestImportFromFS(t *testing.T) { if repo.Name != "test" { t.Error("unexpected repo name") } -} \ No newline at end of file +}