1
0
mirror of synced 2026-07-09 18:20:48 +00:00

Add --add-ignore-paths flag to artifact commands

The existing --ignore-paths flag replaces the built-in default exclude
list (VCS files and common ignored extensions), which forces users to
re-specify every default when they only need to add one extra pattern.

This change introduces --add-ignore-paths for push/build/diff artifact,
which appends its values to whichever ignore set is currently in effect
(defaults when --ignore-paths is omitted, or the user override when it
is provided). --ignore-paths semantics are unchanged.

Signed-off-by: Ruslan Shaydullin <shaydullin.r.d@outlook.com>
Assisted-by: claude-code/claude-opus-4-7
This commit is contained in:
Ruslan Shaydullin
2026-05-11 01:49:09 +05:00
parent 75f808c6a6
commit ddf3d9e835
4 changed files with 84 additions and 8 deletions
+54
View File
@@ -180,6 +180,60 @@ func Test_resolveSymlinks_cycle(t *testing.T) {
g.Expect(os.IsNotExist(err)).To(BeTrue())
}
func Test_composeIgnorePaths(t *testing.T) {
tests := []struct {
name string
ignorePaths []string
addIgnorePaths []string
want []string
}{
{
name: "both nil returns nil",
ignorePaths: nil,
addIgnorePaths: nil,
want: nil,
},
{
name: "only ignore-paths passes through",
ignorePaths: []string{"foo", "bar"},
addIgnorePaths: nil,
want: []string{"foo", "bar"},
},
{
name: "only add-ignore-paths passes through",
ignorePaths: nil,
addIgnorePaths: []string{"baz"},
want: []string{"baz"},
},
{
name: "both provided, order preserved",
ignorePaths: []string{"foo", "bar"},
addIgnorePaths: []string{"baz", "qux"},
want: []string{"foo", "bar", "baz", "qux"},
},
{
name: "duplicates retained as-is",
ignorePaths: []string{"foo", "bar"},
addIgnorePaths: []string{"foo"},
want: []string{"foo", "bar", "foo"},
},
{
name: "defaults plus add",
ignorePaths: excludeOCI,
addIgnorePaths: []string{"my-secrets/"},
want: append(append([]string{}, excludeOCI...), "my-secrets/"),
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
g := NewWithT(t)
got := composeIgnorePaths(tt.ignorePaths, tt.addIgnorePaths)
g.Expect(got).To(Equal(tt.want))
})
}
}
func Test_resolveSymlinks_multipleLinksSameTarget(t *testing.T) {
g := NewWithT(t)