Skip to content

Commit

Permalink
Back out of removing pattern addition to expansions
Browse files Browse the repository at this point in the history
  • Loading branch information
jtmcg committed Feb 21, 2025
1 parent a187cb1 commit 90b4e9a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion pkg/cmdutil/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ func GlobWindowsPaths(patterns []string) ([]string, error) {
if err != nil {
return nil, fmt.Errorf("%s: %v", pattern, err)
}
if len(matches) != 0 {
if len(matches) > 0 {
expansions = append(expansions, matches...)
} else {
expansions = append(expansions, pattern)
}
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/cmdutil/args_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ func TestGlobWindowsPaths(t *testing.T) {
wantErr: nil,
},
{
name: "When no files match, it returns an empty expansions array",
name: "When no files match, it returns an empty expansions array, it returns the unmatched patterns",
patterns: []string{"foo", "bar"},
wantOut: []string{},
wantOut: []string{"foo", "bar"},
wantErr: nil,
},
{
Expand Down

0 comments on commit 90b4e9a

Please sign in to comment.