From d78ede2b4e212e15095c288b49df1654c35895d0 Mon Sep 17 00:00:00 2001 From: Gavin Chappell Date: Sat, 24 Aug 2019 08:39:54 +0100 Subject: [PATCH] Ignore ".git" file in output directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ignore files specifically called ".git" in order to preserve submodule information for Git post-1.7.8 (which seems to be the point things changed from having an entire “.git” directory inside the submodule to having a “.git” _file_ pointing to a gitdir outside of the submodule) This should reproduce what I believe is the intended behaviour from #3202 and fix the issue for pojebunny in #4546 See #3202 and #4546 --- commands/hugo.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/hugo.go b/commands/hugo.go index 3da059cc55a..6f7eb0d0b69 100644 --- a/commands/hugo.go +++ b/commands/hugo.go @@ -636,7 +636,7 @@ func (c *commandeer) copyStaticTo(sourceFs *filesystems.SourceFilesystem) (uint6 c.logger.INFO.Println("removing all files from destination that don't exist in static dirs") syncer.DeleteFilter = func(f os.FileInfo) bool { - return f.IsDir() && strings.HasPrefix(f.Name(), ".") + return (f.IsDir() && strings.HasPrefix(f.Name(), ".")) || (!f.IsDir() && f.Name() == ".git") } } c.logger.INFO.Println("syncing static files to", publishDir)