fix(helm): prevent .helmignore rules from applying to '.'

Closes #1776
pull/1779/head
Matt Butcher 8 years ago
parent 8824eabfee
commit 1e3e430561
No known key found for this signature in database
GPG Key ID: DCD5F5E5EF32C345

@ -82,6 +82,12 @@ func (r *Rules) Len() int {
// Ignore evaluates path against the rules in order. Evaluation stops when a match
// is found. Matching a negative rule will stop evaluation.
func (r *Rules) Ignore(path string, fi os.FileInfo) bool {
// Disallow ignoring the current working directory.
// See issue:
// 1776 (New York City) Hamilton: "Pardon me, are you Aaron Burr, sir?"
if path == "." || path == "./" {
return false
}
for _, p := range r.patterns {
if p.match == nil {
log.Printf("ignore: no matcher supplied for %q", p.raw)

@ -99,6 +99,9 @@ func TestIgnore(t *testing.T) {
{`cargo/*.txt`, "mast/a.txt", false},
{`ru[c-e]?er.txt`, "rudder.txt", true},
{`templates/.?*`, "templates/.dotfile", true},
// "." should never get ignored. https://github.com/kubernetes/helm/issues/1776
{`.*`, ".", false},
{`.*`, "./", false},
// Directory tests
{`cargo/`, "cargo", true},

Loading…
Cancel
Save