mirror of
https://github.com/zsh-users/zsh
synced 2024-10-01 13:44:44 +00:00
52910: Improve handling of **/ patterns
This commit is contained in:
parent
7f196de9d7
commit
300ce96080
|
@ -1,5 +1,7 @@
|
||||||
2024-05-24 Bart Schaefer <schaefer@zsh.org>
|
2024-05-24 Bart Schaefer <schaefer@zsh.org>
|
||||||
|
|
||||||
|
* 52910: Functions/Misc/zmv: Improve handling of **/ patterns
|
||||||
|
|
||||||
* 52904: Completion/Unix/Command/_git: Improve quoting of paths
|
* 52904: Completion/Unix/Command/_git: Improve quoting of paths
|
||||||
passed via _call_program to "git ls-files"
|
passed via _call_program to "git ls-files"
|
||||||
|
|
||||||
|
|
|
@ -249,13 +249,13 @@ errs=()
|
||||||
(( ${#files} )) || errs=( "no files matched \`$fpat'" )
|
(( ${#files} )) || errs=( "no files matched \`$fpat'" )
|
||||||
|
|
||||||
for f in $files; do
|
for f in $files; do
|
||||||
if [[ $pat = (#b)(*)\(\*\*##/\)(*) ]]; then
|
if [[ $pat = (#b)(*)(\(\*\*##/\)|\*\*##/)(*) ]]; then
|
||||||
# This looks like a recursive glob. This isn't good enough,
|
# This looks like a recursive glob. This isn't good enough,
|
||||||
# because we should really enforce that $match[1] and $match[2]
|
# because we should really enforce that $match[1] and $match[3]
|
||||||
# don't match slashes unless they were explicitly given. But
|
# don't match slashes unless they were explicitly given. But
|
||||||
# it's a start. It's fine for the classic case where (**/) is
|
# it's a start. It's fine for the classic case where (**/) is
|
||||||
# at the start of the pattern.
|
# at the start of the pattern.
|
||||||
pat="$match[1](*/|)$match[2]"
|
pat="$match[1](*/|)$match[3]"
|
||||||
fi
|
fi
|
||||||
[[ -e $f && $f = (#b)${~pat} ]] || continue
|
[[ -e $f && $f = (#b)${~pat} ]] || continue
|
||||||
set -- "$match[@]"
|
set -- "$match[@]"
|
||||||
|
|
Loading…
Reference in a new issue