Merge pull request #9896

348ed19d9 guix: ask for confirmation before deleting files (tobtoht)
This commit is contained in:
tobtoht 2025-04-22 13:32:42 +00:00
commit cef67a7412
No known key found for this signature in database
GPG key ID: E45B10DD027D2472

View file

@ -80,4 +80,19 @@ for precious_dirs_file in "${found_precious_dirs_files[@]}"; do
done < "$precious_dirs_file"
done
output="$(git clean --dry-run -xdff "${exclude_flags[@]}")"
if [[ -z "${output}" ]]; then
echo "Nothing to clean."
exit 0
fi
if [[ -z "${NO_CONFIRM}" ]]; then
echo "${output}"
read -p "Confirm deletion [y/N]: " confirm
if [[ ! "${confirm}" =~ ^[Yy]$ ]]; then
exit 0
fi
fi
git clean -xdff "${exclude_flags[@]}"