aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/repos5
1 files changed, 3 insertions, 2 deletions
diff --git a/bin/repos b/bin/repos
index 2d95410..1e764ca 100755
--- a/bin/repos
+++ b/bin/repos
@@ -67,6 +67,7 @@ array_decode() {
#
+# CAVEAT:
# To avoid needing to keep decoding the array elements on every call to
# `arr_includes`, assume directory names don't contain newlines. This makes the
# current code scanning ~/dev/ from 8 seconds go to 1 second.
@@ -78,14 +79,14 @@ arr_push() {
if [ -n "$ARR" ]; then
echo "$ARR"
fi
- echo "$ELT" # | array_encode
+ echo "$ELT" # | array_encode (see CAVEAT)
}
arr_includes() {
ARR="$1"
ELT="$2"
echo "$ARR" | while read -r el; do
- # if [ "$(printf '%s\n' "$el" | array_decode)" = "$ELT" ]; then
+ # if [ "$(printf '%s\n' "$el" | array_decode)" = "$ELT" ]; then (see CAVEAT)
if [ "$el" = "$ELT" ]; then
return 2
fi