hugolib: Fix broken bundle live reload logic
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Fri, 6 Sep 2019 09:03:23 +0000 (11:03 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Fri, 6 Sep 2019 09:03:23 +0000 (11:03 +0200)
Fixes #6315
Updates #6308

hugolib/hugo_sites.go

index 987144f1df15ad20e43e17ab7d4190d2f924efb1..c0d75c09f52b8576500ea45b59eb7278ab731f38 100644 (file)
@@ -837,15 +837,16 @@ type contentChangeMap struct {
        symContent   map[string]map[string]bool
 }
 
-func (m *contentChangeMap) add(filename string, tp bundleDirType) {
+func (m *contentChangeMap) add(dirname string, tp bundleDirType) {
        m.mu.Lock()
-       dir := filepath.Dir(filename) + helpers.FilePathSeparator
-       dir = strings.TrimPrefix(dir, ".")
+       if !strings.HasSuffix(dirname, helpers.FilePathSeparator) {
+               dirname += helpers.FilePathSeparator
+       }
        switch tp {
        case bundleBranch:
-               m.branchBundles[dir] = true
+               m.branchBundles[dirname] = true
        case bundleLeaf:
-               m.leafBundles.Insert(dir, true)
+               m.leafBundles.Insert(dirname, true)
        default:
                panic("invalid bundle type")
        }