Skip to content

Commit

Permalink
Treat source irregularity as errors
Browse files Browse the repository at this point in the history
  • Loading branch information
evanpurkhiser committed Feb 19, 2020
1 parent 15d5a57 commit 76a760e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
5 changes: 0 additions & 5 deletions installer/installer.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package installer

import (
"fmt"
"io"
"os"
"path"
Expand Down Expand Up @@ -57,10 +56,6 @@ func InstallDotfile(dotfile *PreparedDotfile, config InstallConfig) error {
installPath = config.OverrideInstallPath + separator + dotfile.Path
}

if dotfile.SourcesAreIrregular {
return fmt.Errorf("Source files are not all regular files")
}

if !dotfile.IsChanged() && !config.ForceReinstall {
return nil
}
Expand Down
5 changes: 5 additions & 0 deletions installer/prepare.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package installer

import (
"fmt"
"os"
"sync"

Expand Down Expand Up @@ -164,6 +165,10 @@ func PrepareDotfiles(dotfiles resolver.Dotfiles, config config.SourceConfig) Pre
prepared.SourcePermissionsDiffer = tookLowest
prepared.SourcesAreIrregular = !isAllRegular(sourceInfo)

if prepared.SourcesAreIrregular {
prepared.PrepareError = fmt.Errorf("Source files are not all regular files")
}

// Nothing needs to be verified if the dotfile is being added or removed.
if !exists || dotfile.Removed {
return
Expand Down
4 changes: 0 additions & 4 deletions output/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,6 @@ func (l *Output) DotfileInfo(dotfile *installer.PreparedDotfile) {
ln(e, color.HiRedString(dotfile.PrepareError.Error()))
}

if dotfile.SourcesAreIrregular {
ln(e, "source files are irregular")
}

if dotfile.OverwritesExisting {
ln(w, "ovewriting existing file")
}
Expand Down

0 comments on commit 76a760e

Please sign in to comment.