mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-07 14:18:18 +02:00
guix: Make guix-clean less destructive
* Show preview and ask for confirmation before git clean unless used with "--force" * Error out when trying to pass args such as "guix-clean --help"
This commit is contained in:
@@ -9,6 +9,14 @@ set -e -o pipefail
|
|||||||
# shellcheck source=libexec/prelude.bash
|
# shellcheck source=libexec/prelude.bash
|
||||||
source "$(dirname "${BASH_SOURCE[0]}")/libexec/prelude.bash"
|
source "$(dirname "${BASH_SOURCE[0]}")/libexec/prelude.bash"
|
||||||
|
|
||||||
|
# Parse supported args
|
||||||
|
FORCE=0
|
||||||
|
if [[ $* == "--force" ]]; then
|
||||||
|
FORCE=1
|
||||||
|
elif [ $# != 0 ]; then
|
||||||
|
echo "Script only takes optional --force arg."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
###################
|
###################
|
||||||
## Sanity Checks ##
|
## Sanity Checks ##
|
||||||
@@ -80,4 +88,14 @@ for precious_dirs_file in "${found_precious_dirs_files[@]}"; do
|
|||||||
done < "$precious_dirs_file"
|
done < "$precious_dirs_file"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [[ $FORCE == 0 ]]; then
|
||||||
|
git clean -nxdff "${exclude_flags[@]}"
|
||||||
|
|
||||||
|
read -p "Proceed? (y/n) " -r
|
||||||
|
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||||
|
echo "Aborted."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
git clean -xdff "${exclude_flags[@]}"
|
git clean -xdff "${exclude_flags[@]}"
|
||||||
|
|||||||
Reference in New Issue
Block a user