aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cpt-lib.in3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/cpt-lib.in b/src/cpt-lib.in
index 1bcd8bc..5690ebe 100644
--- 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