Skip to content

Please make --cleanDestinationDir spare more than just the .git directory #14097

@mikenakis

Description

@mikenakis

@jmooring asked me to create this proposal as a result of the discussion in that thread: https://discourse.gohugo.io/t/please-make-taxonomy-bycount-produce-a-stable-ordering/56149

Currently, when Hugo cleans the destination directory, it uses a filter defined in commands/hugobuilder.go as follows:

    		syncer.DeleteFilter = func(f fsync.FileInfo) bool {
    			return f.IsDir() && strings.HasPrefix(f.Name(), ".")
    		}

So, it refrains from deleting directories prefixed with a dot.

This means that it will spare my .git directory, but it won't spare my .gitignore file. So, my .gitignore file gets deleted on every single hugo build, which is a bummer.

This is a proposal to extend the filter a bit.

@jmooring suggests that the filter should additionally spare the .gitignore and .gitattributes files only.

I think it would be better to simply get rid of the f.isDir() && part so that the filter spares anything prefixed with a dot.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions