shithub: hugo

Download patch

ref: 32d82a4496e5f53a723293175e72b5a57ea6e5a3
parent: d44bb4ec05553b95ef601bf3951e5755b1cbd5a0
author: Alexandre Bourget <[email protected]>
date: Sun Jul 10 16:01:45 EDT 2016

Ignore emacs temp files


--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -745,17 +745,20 @@
 
 				for _, ev := range evs {
 					ext := filepath.Ext(ev.Name)
+					baseName := filepath.Base(ev.Name)
 					istemp := strings.HasSuffix(ext, "~") ||
 						(ext == ".swp") || // vim
 						(ext == ".swx") || // vim
 						(ext == ".tmp") || // generic temp file
 						(ext == ".DS_Store") || // OSX Thumbnail
-						filepath.Base(ev.Name) == "4913" || // vim
+						baseName == "4913" || // vim
 						strings.HasPrefix(ext, ".goutputstream") || // gnome
 						strings.HasSuffix(ext, "jb_old___") || // intelliJ
 						strings.HasSuffix(ext, "jb_tmp___") || // intelliJ
 						strings.HasSuffix(ext, "jb_bak___") || // intelliJ
-						strings.HasPrefix(ext, ".sb-") // byword
+						strings.HasPrefix(ext, ".sb-") || // byword
+						strings.HasPrefix(baseName, ".#") || // emacs
+						strings.HasPrefix(baseName, "#") // emacs
 					if istemp {
 						continue
 					}
--- a/source/content_directory_test.go
+++ b/source/content_directory_test.go
@@ -43,6 +43,8 @@
 		{"foobar/foo.html", false, []string{"\\.md$", "\\.boo$"}},
 		{"foobar/foo.md", true, []string{"^foo"}},
 		{"foobar/foo.md", false, []string{"*", "\\.md$", "\\.boo$"}},
+		{"foobar/.#content.md", true, []string{"/\\.#"}},
+		{".#foobar.md", true, []string{"^\\.#"}},
 	}
 
 	for _, test := range tests {