mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-09 00:31:14 -03:00
[string] Match everything with an empty pattern and -e
I.e. `string match --entire "" -- banana` used to match nothing, now it matches everything. Fixes #4971.
This commit is contained in:
@@ -628,7 +628,8 @@ class wildcard_matcher_t : public string_matcher_t {
|
||||
wcpattern[i] = towlower(wcpattern[i]);
|
||||
}
|
||||
}
|
||||
if (opts.entire && !wcpattern.empty()) {
|
||||
if (opts.entire) {
|
||||
// If the pattern is empty, this becomes one ANY_STRING that matches everything.
|
||||
if (wcpattern.front() != ANY_STRING) wcpattern.insert(0, 1, ANY_STRING);
|
||||
if (wcpattern.back() != ANY_STRING) wcpattern.push_back(ANY_STRING);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user