mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Trailing slashes in wildcards need to match directories
Fixes the wrong sense in a waccess test.
This commit is contained in:
parent
aa37b40d93
commit
dd245f62f0
2 changed files with 10 additions and 1 deletions
|
@ -1514,6 +1514,15 @@ static void test_expand()
|
|||
L"/tmp/fish_expand_test/b", L"/tmp/fish_expand_test/b/x", L"/tmp/fish_expand_test/bar", L"/tmp/fish_expand_test/bax", L"/tmp/fish_expand_test/bax/xxx", L"/tmp/fish_expand_test/baz", L"/tmp/fish_expand_test/baz/xxx", L"/tmp/fish_expand_test/baz/yyy", wnull,
|
||||
L"Glob did the wrong thing 4");
|
||||
|
||||
// a trailing slash should only produce directories
|
||||
expand_test(L"/tmp/fish_expand_test/b*/", 0,
|
||||
L"/tmp/fish_expand_test/b/", L"/tmp/fish_expand_test/baz/", L"/tmp/fish_expand_test/bax/", wnull,
|
||||
L"Glob did the wrong thing 5");
|
||||
|
||||
expand_test(L"/tmp/fish_expand_test/b**/", 0,
|
||||
L"/tmp/fish_expand_test/b/", L"/tmp/fish_expand_test/baz/", L"/tmp/fish_expand_test/bax/", wnull,
|
||||
L"Glob did the wrong thing 6");
|
||||
|
||||
expand_test(L"/tmp/fish_expand_test/BA", EXPAND_FOR_COMPLETIONS,
|
||||
L"/tmp/fish_expand_test/bar", L"/tmp/fish_expand_test/bax/", L"/tmp/fish_expand_test/baz/", wnull,
|
||||
L"Case insensitive test did the wrong thing");
|
||||
|
|
|
@ -787,7 +787,7 @@ void wildcard_expander_t::expand_trailing_slash(const wcstring &base_dir)
|
|||
if (! (flags & EXPAND_FOR_COMPLETIONS))
|
||||
{
|
||||
/* Trailing slash and not accepting incomplete, e.g. `echo /tmp/`. Insert this file if it exists. */
|
||||
if (waccess(base_dir, F_OK))
|
||||
if (waccess(base_dir, F_OK) == 0)
|
||||
{
|
||||
this->add_expansion_result(base_dir);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue