summaryrefslogtreecommitdiffstats
path: root/hugolib
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-09-09 16:51:13 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-09-10 08:47:05 +0200
commit9a1e6d15a31ec667b2ff9cf20e43b1daca61e004 (patch)
tree1e5bfed58030989858820e3e2e1ceba0b46a31c2 /hugolib
parent84adecf97baa91ab18cb26812fa864b4451d3c5f (diff)
modules: Make ignoreVendor a glob pattern
Fixes #7642
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/config.go14
-rw-r--r--hugolib/hugo_modules_test.go8
2 files changed, 19 insertions, 3 deletions
diff --git a/hugolib/config.go b/hugolib/config.go
index 841bd5193..cab2013ca 100644
--- a/hugolib/config.go
+++ b/hugolib/config.go
@@ -18,6 +18,9 @@ import (
"path/filepath"
"strings"
+ "github.com/gobwas/glob"
+ hglob "github.com/gohugoio/hugo/hugofs/glob"
+
"github.com/gohugoio/hugo/common/loggers"
"github.com/gohugoio/hugo/cache/filecache"
@@ -202,6 +205,12 @@ func LoadConfig(d ConfigSourceDescriptor, doWithConfig ...func(cfg config.Provid
}
}
+ // We made this a Glob pattern in Hugo 0.75, we don't need both.
+ if v.GetBool("ignoreVendor") {
+ helpers.Deprecated("--ignoreVendor", "--ignoreVendorPaths **", false)
+ v.Set("ignoreVendorPaths", "**")
+ }
+
modulesConfig, err := l.loadModulesConfig(v)
if err != nil {
return v, configFiles, err
@@ -417,7 +426,10 @@ func (l configLoader) collectModules(modConfig modules.Config, v1 *viper.Viper,
themesDir := paths.AbsPathify(l.WorkingDir, v1.GetString("themesDir"))
- ignoreVendor := v1.GetBool("ignoreVendor")
+ var ignoreVendor glob.Glob
+ if s := v1.GetString("ignoreVendorPaths"); s != "" {
+ ignoreVendor, _ = hglob.GetGlob(hglob.NormalizePath(s))
+ }
filecacheConfigs, err := filecache.DecodeConfig(l.Fs, v1)
if err != nil {
diff --git a/hugolib/hugo_modules_test.go b/hugolib/hugo_modules_test.go
index b69503021..037684862 100644
--- a/hugolib/hugo_modules_test.go
+++ b/hugolib/hugo_modules_test.go
@@ -126,11 +126,15 @@ baseURL = "https://example.com"
title = "My Modular Site"
workingDir = %q
theme = %q
-ignoreVendor = %t
+ignoreVendorPaths = %q
`
- config := fmt.Sprintf(configTemplate, workingDir, m.Path(), ignoreVendor)
+ ignoreVendorPaths := ""
+ if ignoreVendor {
+ ignoreVendorPaths = "github.com/**"
+ }
+ config := fmt.Sprintf(configTemplate, workingDir, m.Path(), ignoreVendorPaths)
b := newTestSitesBuilder(t)