Skip to content

Commit

Permalink
Revert "Remove the --cleanDestinationDir flag", there is a better fix.
Browse files Browse the repository at this point in the history
This reverts commit 768ec5d.
  • Loading branch information
biodranik authored and bep committed Jan 10, 2018
1 parent f0eecc6 commit 1921a70
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions commands/hugo.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ func initRootPersistentFlags() {
// initHugoBuildCommonFlags initialize common flags related to the Hugo build.
// Called by initHugoBuilderFlags.
func initHugoBuildCommonFlags(cmd *cobra.Command) {
cmd.Flags().Bool("cleanDestinationDir", false, "remove files from destination not found in static directories")
cmd.Flags().BoolP("buildDrafts", "D", false, "include content marked as draft")
cmd.Flags().BoolP("buildFuture", "F", false, "include content with publishdate in the future")
cmd.Flags().BoolP("buildExpired", "E", false, "include expired content")
Expand Down Expand Up @@ -483,6 +484,7 @@ func createLogger(cfg config.Provider) (*jww.Notepad, error) {
func (c *commandeer) initializeFlags(cmd *cobra.Command) {
persFlagKeys := []string{"debug", "verbose", "logFile"}
flagKeys := []string{
"cleanDestinationDir",
"buildDrafts",
"buildFuture",
"buildExpired",
Expand Down Expand Up @@ -722,6 +724,9 @@ func (c *commandeer) copyStaticTo(dirs *src.Dirs, publishDir string) (uint64, er
syncer.NoChmod = c.Cfg.GetBool("noChmod")
syncer.SrcFs = fs
syncer.DestFs = c.Fs.Destination
// Now that we are using a unionFs for the static directories
// We can effectively clean the publishDir on initial sync
syncer.Delete = c.Cfg.GetBool("cleanDestinationDir")

if syncer.Delete {
c.Logger.INFO.Println("removing all files from destination that don't exist in static dirs")
Expand Down
1 change: 1 addition & 0 deletions hugolib/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ func loadDefaultSettingsFor(v *viper.Viper) error {
return err
}

v.SetDefault("cleanDestinationDir", false)
v.SetDefault("watch", false)
v.SetDefault("metaDataFormat", "toml")
v.SetDefault("disable404", false)
Expand Down

0 comments on commit 1921a70

Please sign in to comment.