Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
d5170d23
Commit
d5170d23
authored
Aug 26, 2016
by
Matt Butcher
Committed by
GitHub
Aug 26, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1116 from ammeon/ignore-chart-dotfiles
feat(helm): package to ignore all dotfiles by default
parents
e2f9d894
96de0e35
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
1 deletion
+18
-1
load.go
pkg/chartutil/load.go
+1
-0
rules.go
pkg/ignore/rules.go
+7
-0
rules_test.go
pkg/ignore/rules_test.go
+10
-1
.dotfile
pkg/ignore/testdata/templates/.dotfile
+0
-0
No files found.
pkg/chartutil/load.go
View file @
d5170d23
...
...
@@ -208,6 +208,7 @@ func LoadDir(dir string) (*chart.Chart, error) {
}
rules
=
r
}
rules
.
AddDefaults
()
files
:=
[]
*
afile
{}
topdir
+=
string
(
filepath
.
Separator
)
...
...
pkg/ignore/rules.go
View file @
d5170d23
...
...
@@ -42,6 +42,13 @@ func Empty() *Rules {
return
&
Rules
{
patterns
:
[]
*
pattern
{}}
}
// AddDefaults adds default ignore patterns.
//
// Ignore all dotfiles in "templates/"
func
(
r
*
Rules
)
AddDefaults
()
{
r
.
parseRule
(
`templates/.?*`
)
}
// ParseFile parses a helmignore file and returns the *Rules.
func
ParseFile
(
file
string
)
(
*
Rules
,
error
)
{
f
,
err
:=
os
.
Open
(
file
)
...
...
pkg/ignore/rules_test.go
View file @
d5170d23
...
...
@@ -63,7 +63,6 @@ func TestParseFail(t *testing.T) {
t
.
Errorf
(
"Rule %q should have failed"
,
fail
)
}
}
}
func
TestParseFile
(
t
*
testing
.
T
)
{
...
...
@@ -99,6 +98,7 @@ func TestIgnore(t *testing.T) {
{
`cargo/*.*`
,
"cargo/a.txt"
,
true
},
{
`cargo/*.txt`
,
"mast/a.txt"
,
false
},
{
`ru[c-e]?er.txt`
,
"rudder.txt"
,
true
},
{
`templates/.?*`
,
"templates/.dotfile"
,
true
},
// Directory tests
{
`cargo/`
,
"cargo"
,
true
},
...
...
@@ -134,6 +134,15 @@ func TestIgnore(t *testing.T) {
}
}
func
TestAddDefaults
(
t
*
testing
.
T
)
{
r
:=
Rules
{}
r
.
AddDefaults
()
if
len
(
r
.
patterns
)
!=
1
{
t
.
Errorf
(
"Expected 1 default patterns, got %d"
,
len
(
r
.
patterns
))
}
}
func
parseString
(
str
string
)
(
*
Rules
,
error
)
{
b
:=
bytes
.
NewBuffer
([]
byte
(
str
))
return
Parse
(
b
)
...
...
pkg/ignore/testdata/templates/.dotfile
0 → 100644
View file @
d5170d23
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment