mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-28 12:45:13 +00:00
Revert "wildcard: Remove useless access() call for trailing slash"
This reverts commit 6823f5e337
.
Fixes #10205
This commit is contained in:
parent
001f797f80
commit
c31e194120
2 changed files with 9 additions and 2 deletions
|
@ -646,8 +646,11 @@ void wildcard_expander_t::expand_trailing_slash(const wcstring &base_dir, const
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(flags & expand_flag::for_completions)) {
|
if (!(flags & expand_flag::for_completions)) {
|
||||||
// Trailing slash and not accepting incomplete, e.g. `echo /xyz/`. Insert this file, we already know it exists!
|
// Trailing slash and not accepting incomplete, e.g. `echo /xyz/`. Insert this file if it
|
||||||
|
// exists.
|
||||||
|
if (waccess(base_dir, F_OK) == 0) {
|
||||||
this->add_expansion_result(wcstring{base_dir});
|
this->add_expansion_result(wcstring{base_dir});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Trailing slashes and accepting incomplete, e.g. `echo /xyz/<tab>`. Everything is added.
|
// Trailing slashes and accepting incomplete, e.g. `echo /xyz/<tab>`. Everything is added.
|
||||||
dir_iter_t dir = open_dir(base_dir);
|
dir_iter_t dir = open_dir(base_dir);
|
||||||
|
|
|
@ -11,6 +11,10 @@ touch ./b/file.txt
|
||||||
|
|
||||||
set dirs ./a ./b
|
set dirs ./a ./b
|
||||||
echo $dirs/*.txt # CHECK: ./b/file.txt
|
echo $dirs/*.txt # CHECK: ./b/file.txt
|
||||||
|
echo */foo/
|
||||||
|
# CHECKERR: checks/wildcard.fish (line {{\d+}}): No matches for wildcard '*/foo/'. See `help wildcards-globbing`.
|
||||||
|
# CHECKERR: echo */foo/
|
||||||
|
# CHECKERR: ^~~~~^
|
||||||
|
|
||||||
cd $oldpwd
|
cd $oldpwd
|
||||||
rm -Rf $dir
|
rm -Rf $dir
|
||||||
|
|
Loading…
Reference in a new issue