cpt

Carbs Packaging Tools
git clone git://git.carbslinux.org/cpt
Log | Files | Refs | README | LICENSE

commit 1f57d2b0a4e3f15c7acd6800b1f0430068238bf1
parent 7ef15fca20de97d189fea7ae89ebaced76a8a398
Author: Cem Keylan <cem@ckyln.com>
Date:   Thu,  4 Feb 2021 12:39:45 +0300

pkg_find(): break early if only a single match is requested

Diffstat:
Msrc/cpt-lib.in | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/cpt-lib.in b/src/cpt-lib.in @@ -539,6 +539,9 @@ pkg_find() { for path2 in "$path/"$query; do test "${type:--d}" "$path2" && set -f -- "$@" "$path2" done + # Break early if we only want a single match for a slight increase + # in speed. We don't need to search for the entire path. + [ "$1" ] && [ -z "$match" ] && break done IFS=$old_ifs