From 033a13e10e5ef42424db72ae45e01380b0d1e07c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sun, 28 Jun 2015 19:27:28 +0200 Subject: [PATCH] Fix watcher detecting changes as static when no theme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- commands/hugo.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/hugo.go b/commands/hugo.go index 5cea9d095..c57f5fe4e 100644 --- a/commands/hugo.go +++ b/commands/hugo.go @@ -444,7 +444,7 @@ func NewWatcher(port int) error { 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