diff --git a/main.go b/main.go index eb09672..36cc25e 100644 --- a/main.go +++ b/main.go @@ -4,6 +4,7 @@ package main import ( "bytes" "context" + "errors" "fmt" "io" "io/ioutil" @@ -520,7 +521,9 @@ func buildAll(ctx context.Context, watch bool) error { filepath.Walk(".", func(path string, info os.FileInfo, err error) error { // rebuild if changes to .zs/ or .zsignore if (filepath.Base(path) == ZSIGNORE || filepath.Dir(path) == ZSDIR) && info.ModTime().After(lastModified) { - Ignore = ParseIgnoreFile(path) + if filepath.Base(path) == ZSIGNORE { + Ignore = ParseIgnoreFile(path) + } // reset lastModified to 0 so everything rebuidls lastModified = time.Unix(0, 0) return nil @@ -623,7 +626,9 @@ func init() { func ParseIgnoreFile(fn string) *ignore.GitIgnore { obj, err := ignore.CompileIgnoreFile(ZSIGNORE) if err != nil { - log.WithError(err).Warnf("error parsing .zsignore: %s (using defaults)s", fn) + if !errors.Is(err, os.ErrNotExist) { + log.WithError(err).Warnf("error parsing .zsignore: %s (using defaults)s", fn) + } return ignore.CompileIgnoreLines(DefaultIgnore) } diff --git a/testdata/extensions/.test/index.html b/testdata/extensions/.test/index.html index 7dc7db4..ef8cfca 100644 --- a/testdata/extensions/.test/index.html +++ b/testdata/extensions/.test/index.html @@ -2,7 +2,7 @@ Hello World -

Hello World

+

Hello World

Hello World!

diff --git a/testdata/ignore/.test/index.html b/testdata/ignore/.test/index.html index 80b5a0d..417c430 100644 --- a/testdata/ignore/.test/index.html +++ b/testdata/ignore/.test/index.html @@ -1,5 +1,5 @@ -

Simple

+

Simple

Simple page

diff --git a/testdata/simple/.test/index.html b/testdata/simple/.test/index.html index 80b5a0d..417c430 100644 --- a/testdata/simple/.test/index.html +++ b/testdata/simple/.test/index.html @@ -1,5 +1,5 @@ -

Simple

+

Simple

Simple page

diff --git a/testdata/variables/.test/index.html b/testdata/variables/.test/index.html index 9307c98..25dfc33 100644 --- a/testdata/variables/.test/index.html +++ b/testdata/variables/.test/index.html @@ -2,7 +2,7 @@ Simple -

Simple

+

Simple

Simple page