From e53bc948a5932805be4b0d29f1d809f7d5938cab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ask=20Bj=C3=B8rn=20Hansen?= Date: Thu, 27 Feb 2014 21:26:17 -0800 Subject: [PATCH] Ignore content files ending in ~ Also add *~ to .gitignore --- .gitignore | 1 + source/filesystem.go | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index df079f250..297d8d815 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ hugo.exe *.swp *.swo .DS_Store +*~ diff --git a/source/filesystem.go b/source/filesystem.go index cefe4a950..96853c8dd 100644 --- a/source/filesystem.go +++ b/source/filesystem.go @@ -117,5 +117,14 @@ func (f *Filesystem) avoid(filePath string) bool { } func ignoreDotFile(filePath string) bool { - return filepath.Base(filePath)[0] == '.' + base := filepath.Base(filePath) + if base[0] == '.' { + return true + } + + if base[len(base)-1] == '~' { + return true + } + + return false }