shithub: hugo

Download patch

ref: 033a13e10e5ef42424db72ae45e01380b0d1e07c
parent: a509a23255d20769621a2d2a714964fc3c6bca55
author: Bjørn Erik Pedersen <[email protected]>
date: Sun Jun 28 15:27:28 EDT 2015

Fix watcher detecting changes as static when no theme

There have been some changes to the ´helpers.GetThemesDirPath()´ so it now returns an empty string when no theme.

This is correct, but it broke the watch service (at lest on OSX), as `strings.HasPrefix("", "somestring") evaluates to true somehow, and content changes are incorrectly branded as static.

There are other issues in there, but that will come later ...

See #1236

--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -444,7 +444,7 @@
 						continue
 					}
 
-					isstatic := strings.HasPrefix(ev.Name, helpers.GetStaticDirPath()) || strings.HasPrefix(ev.Name, helpers.GetThemesDirPath())
+					isstatic := strings.HasPrefix(ev.Name, helpers.GetStaticDirPath()) || (len(helpers.GetThemesDirPath()) > 0 && strings.HasPrefix(ev.Name, helpers.GetThemesDirPath()))
 					staticChanged = staticChanged || isstatic
 					dynamicChanged = dynamicChanged || !isstatic