Outside of `.pulumiignore` we support a few "default" excludes that try to push folks towards a pit of succes. Previously, there was no way to opt out of these, which would be bad if our huristics caused something youto really care about to be elided. With this change, we add an optional setting in Pulumi.yaml that allows you to opt out of this behavior. As part of the work, I changed .git to be one of these "default" excludes instead of it only happening if you had a .pulumiignore file in a directory
34 lines
694 B
Go
34 lines
694 B
Go
// Copyright 2016-2017, Pulumi Corporation. All rights reserved.
|
|
|
|
package archive
|
|
|
|
import (
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
// newPathIgnorer creates an ignorer based that ignores either a single file (when dir is false) or
|
|
// and entire directory tree (when dir is true).
|
|
func newPathIgnorer(path string, isDir bool) ignorer {
|
|
if !isDir {
|
|
return &fileIgnorer{path: path}
|
|
}
|
|
|
|
return &directoryIgnorer{path: path + string(os.PathSeparator)}
|
|
}
|
|
|
|
type fileIgnorer struct {
|
|
path string
|
|
}
|
|
|
|
func (fi *fileIgnorer) IsIgnored(f string) bool {
|
|
return f == fi.path
|
|
}
|
|
|
|
type directoryIgnorer struct {
|
|
path string
|
|
}
|
|
|
|
func (di *directoryIgnorer) IsIgnored(f string) bool {
|
|
return strings.HasPrefix(f, di.path)
|
|
}
|