1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-06 05:33:00 +00:00

chore: Do not check if should_protect_path exists

should_protect_path will always be available as it comes from common.sh.
This check adds a lot of overhead as it runs on every file.
This commit is contained in:
Jack Phallen
2026-01-04 21:33:39 -05:00
parent ad42266b09
commit f21a1339a7

View File

@@ -197,12 +197,10 @@ safe_find_delete() {
find_args+=("-mtime" "+$age_days")
fi
# Iterate results to respect should_protect_path when available
# Iterate results to respect should_protect_path
while IFS= read -r -d '' match; do
if command -v should_protect_path > /dev/null 2>&1; then
if should_protect_path "$match"; then
continue
fi
if should_protect_path "$match"; then
continue
fi
safe_remove "$match" true || true
done < <(command find "$base_dir" "${find_args[@]}" -print0 2> /dev/null || true)
@@ -241,12 +239,10 @@ safe_sudo_find_delete() {
find_args+=("-mtime" "+$age_days")
fi
# Iterate results to respect should_protect_path when available
# Iterate results to respect should_protect_path
while IFS= read -r -d '' match; do
if command -v should_protect_path > /dev/null 2>&1; then
if should_protect_path "$match"; then
continue
fi
if should_protect_path "$match"; then
continue
fi
safe_sudo_remove "$match" || true
done < <(sudo find "$base_dir" "${find_args[@]}" -print0 2> /dev/null || true)