import: Fix importing jekyll site

Just use `afero.OsFs` without building site.
Close #9817
This commit is contained in:
satotake 2022-05-22 03:41:28 +09:00 committed by Bjørn Erik Pedersen
parent e164834f0a
commit 2fc2e9c871

View file

@ -36,7 +36,6 @@ import (
"github.com/gohugoio/hugo/common/maps" "github.com/gohugoio/hugo/common/maps"
"github.com/gohugoio/hugo/helpers" "github.com/gohugoio/hugo/helpers"
"github.com/gohugoio/hugo/hugofs" "github.com/gohugoio/hugo/hugofs"
"github.com/gohugoio/hugo/hugolib"
"github.com/gohugoio/hugo/parser" "github.com/gohugoio/hugo/parser"
"github.com/spf13/afero" "github.com/spf13/afero"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -202,12 +201,7 @@ func (i *importCmd) retrieveJekyllPostDir(fs afero.Fs, dir string) (bool, bool)
} }
func (i *importCmd) createSiteFromJekyll(jekyllRoot, targetDir string, jekyllPostDirs map[string]bool, force bool) error { func (i *importCmd) createSiteFromJekyll(jekyllRoot, targetDir string, jekyllPostDirs map[string]bool, force bool) error {
s, err := hugolib.NewSiteDefaultLang() fs := &afero.OsFs{}
if err != nil {
return err
}
fs := s.Fs.Source
if exists, _ := helpers.Exists(targetDir, fs); exists { if exists, _ := helpers.Exists(targetDir, fs); exists {
if isDir, _ := helpers.IsDir(targetDir, fs); !isDir { if isDir, _ := helpers.IsDir(targetDir, fs); !isDir {
return errors.New("target path \"" + targetDir + "\" exists but is not a directory") return errors.New("target path \"" + targetDir + "\" exists but is not a directory")