shithub: hugo

Download patch

ref: 901077c0364eaf3fe4f997c3026aa18cfc7781ed
parent: 24ad4295718341dcae12b72bf52fef312d1036ed
author: Bjørn Erik Pedersen <[email protected]>
date: Fri Sep 6 07:03:23 EDT 2019

hugolib: Fix broken bundle live reload logic

Fixes #6315
Updates #6308

--- a/hugolib/hugo_sites.go
+++ b/hugolib/hugo_sites.go
@@ -837,15 +837,16 @@
 	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")
 	}