Add prompt to guard resetting local repo

pull/339/head
Jeffrey Walton 2016-11-07 05:55:48 -05:00
parent 4c67ae7168
commit e4ddc44957
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
1 changed files with 18 additions and 0 deletions

View File

@ -12,6 +12,22 @@
OLD_VERSION_TAG=CRYPTOPP_5_6_4
NEW_VERSION_TAG=CRYPTOPP_5_6_5
############################################
# If repo is dirty, then promt first
DIRTY=$(git diff --shortstat 2> /dev/null | tail -n1)
if [[ ! (-z "$DIRTY") ]]; then
echo "The local repo is dirty. Continuing will reset the repo and lose changes."
read -p "Type 'Y' to proceed. Proceed? " -n 1 -r
echo # (optional) move to a new line
if [[ !($REPLY =~ ^[Yy]$) ]]; then
[[ "$0" = "$BASH_SOURCE" ]] && exit 0 || return 0
fi
else
echo "The repo is clean. Proceeding..."
fi
############################################
# Setup tools and platforms
@ -255,3 +271,5 @@ else
fi
git checkout master -f &>/dev/null
[[ "$0" = "$BASH_SOURCE" ]] && exit 0 || return 0]