mirror of
https://github.com/gohugoio/hugo.git
synced 2024-12-01 04:51:31 -05:00
parent
2655739940
commit
7a080b624e
4 changed files with 39 additions and 8 deletions
|
@ -270,7 +270,7 @@ func (w *Walkway) walk(path string, info FileMetaInfo, dirEntries []FileMetaInfo
|
||||||
meta.Path = normalizeFilename(pathMeta)
|
meta.Path = normalizeFilename(pathMeta)
|
||||||
meta.PathWalk = pathn
|
meta.PathWalk = pathn
|
||||||
|
|
||||||
if fim.IsDir() && w.isSeen(meta.Filename) {
|
if fim.IsDir() && meta.IsSymlink && w.isSeen(meta.Filename) {
|
||||||
// Prevent infinite recursion
|
// Prevent infinite recursion
|
||||||
// Possible cyclic reference
|
// Possible cyclic reference
|
||||||
meta.SkipDir = true
|
meta.SkipDir = true
|
||||||
|
|
|
@ -81,14 +81,12 @@ func TestWalkRootMappingFs(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Run("Basic", func(c *qt.C) {
|
c.Run("Basic", func(c *qt.C) {
|
||||||
|
|
||||||
bfs := prepare(c)
|
bfs := prepare(c)
|
||||||
|
|
||||||
names, err := collectFilenames(bfs, "", "")
|
names, err := collectFilenames(bfs, "", "")
|
||||||
|
|
||||||
c.Assert(err, qt.IsNil)
|
c.Assert(err, qt.IsNil)
|
||||||
c.Assert(names, qt.DeepEquals, []string{"a/test.txt", "b/test.txt", "c/test.txt"})
|
c.Assert(names, qt.DeepEquals, []string{"a/test.txt", "b/test.txt", "c/test.txt"})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
c.Run("Para", func(c *qt.C) {
|
c.Run("Para", func(c *qt.C) {
|
||||||
|
@ -112,12 +110,10 @@ func TestWalkRootMappingFs(t *testing.T) {
|
||||||
return errors.New("fail")
|
return errors.New("fail")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Assert(r.Wait(), qt.IsNil)
|
c.Assert(r.Wait(), qt.IsNil)
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,7 +165,7 @@ func TestWalkSymbolicLink(t *testing.T) {
|
||||||
names, err := collectFilenames(fs, workDir, workDir)
|
names, err := collectFilenames(fs, workDir, workDir)
|
||||||
c.Assert(err, qt.IsNil)
|
c.Assert(err, qt.IsNil)
|
||||||
|
|
||||||
c.Assert(names, qt.DeepEquals, []string{"blog/real/sub/a.txt", "docs/b.txt"})
|
c.Assert(names, qt.DeepEquals, []string{"blog/real/sub/a.txt", "blog/symlinked/sub/a.txt", "docs/b.txt"})
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("BasePath Fs", func(t *testing.T) {
|
t.Run("BasePath Fs", func(t *testing.T) {
|
||||||
|
|
|
@ -33,7 +33,6 @@ import (
|
||||||
"github.com/gohugoio/hugo/hugofs"
|
"github.com/gohugoio/hugo/hugofs"
|
||||||
"github.com/gohugoio/hugo/hugolib/paths"
|
"github.com/gohugoio/hugo/hugolib/paths"
|
||||||
"github.com/gohugoio/hugo/modules"
|
"github.com/gohugoio/hugo/modules"
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func initConfig(fs afero.Fs, cfg config.Provider) error {
|
func initConfig(fs afero.Fs, cfg config.Provider) error {
|
||||||
|
@ -152,7 +151,7 @@ theme = ["atheme"]
|
||||||
checkFileCount(bfs.Data.Fs, "", c, 11) // 7 + 4 themes
|
checkFileCount(bfs.Data.Fs, "", c, 11) // 7 + 4 themes
|
||||||
checkFileCount(bfs.Archetypes.Fs, "", c, 10) // 8 + 2 themes
|
checkFileCount(bfs.Archetypes.Fs, "", c, 10) // 8 + 2 themes
|
||||||
checkFileCount(bfs.Assets.Fs, "", c, 9)
|
checkFileCount(bfs.Assets.Fs, "", c, 9)
|
||||||
checkFileCount(bfs.Work, "", c, 82)
|
checkFileCount(bfs.Work, "", c, 90)
|
||||||
|
|
||||||
c.Assert(bfs.IsData(filepath.Join(workingDir, "mydata", "file1.txt")), qt.Equals, true)
|
c.Assert(bfs.IsData(filepath.Join(workingDir, "mydata", "file1.txt")), qt.Equals, true)
|
||||||
c.Assert(bfs.IsI18n(filepath.Join(workingDir, "myi18n", "file1.txt")), qt.Equals, true)
|
c.Assert(bfs.IsI18n(filepath.Join(workingDir, "myi18n", "file1.txt")), qt.Equals, true)
|
||||||
|
|
|
@ -1134,3 +1134,39 @@ P1: {{ $p1.Title }}|{{ $p1.RelPermalink }}|Filename: {{ $p1.File.Filename }}
|
||||||
|
|
||||||
b.AssertFileContent("public/index.html", "P1: Abs|/p1/", "Filename: "+contentFilename)
|
b.AssertFileContent("public/index.html", "P1: Abs|/p1/", "Filename: "+contentFilename)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Issue 9426
|
||||||
|
func TestMountSameSource(t *testing.T) {
|
||||||
|
config := `baseURL = 'https://example.org/'
|
||||||
|
languageCode = 'en-us'
|
||||||
|
title = 'Hugo GitHub Issue #9426'
|
||||||
|
|
||||||
|
disableKinds = ['RSS','sitemap','taxonomy','term']
|
||||||
|
|
||||||
|
[[module.mounts]]
|
||||||
|
source = "content"
|
||||||
|
target = "content"
|
||||||
|
|
||||||
|
[[module.mounts]]
|
||||||
|
source = "extra-content"
|
||||||
|
target = "content/resources-a"
|
||||||
|
|
||||||
|
[[module.mounts]]
|
||||||
|
source = "extra-content"
|
||||||
|
target = "content/resources-b"
|
||||||
|
`
|
||||||
|
b := newTestSitesBuilder(t).WithConfigFile("toml", config)
|
||||||
|
|
||||||
|
b.WithContent("p1.md", "")
|
||||||
|
|
||||||
|
b.WithSourceFile(
|
||||||
|
"extra-content/_index.md", "",
|
||||||
|
"extra-content/subdir/_index.md", "",
|
||||||
|
"extra-content/subdir/about.md", "",
|
||||||
|
)
|
||||||
|
|
||||||
|
b.Build(BuildCfg{})
|
||||||
|
|
||||||
|
b.AssertFileContent("public/resources-a/subdir/about/index.html", "Single")
|
||||||
|
b.AssertFileContent("public/resources-b/subdir/about/index.html", "Single")
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue