From bb0a18424bb8e18bef7bd0a032d9b8a1b9d80f90 Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Fri, 8 Mar 2019 20:45:00 -0500 Subject: [PATCH] Build: Only prompt clean if unclean --- bin/build-plugin-zip.sh | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/bin/build-plugin-zip.sh b/bin/build-plugin-zip.sh index 1a6344fa2e67a..6c6d9d10512ee 100755 --- a/bin/build-plugin-zip.sh +++ b/bin/build-plugin-zip.sh @@ -47,18 +47,21 @@ fi # Do a dry run of the repository reset. Prompting the user for a list of all # files that will be removed should prevent them from losing important files! status "Resetting the repository to pristine condition. ✨" -git clean -xdf --dry-run -warning "🚨 About to delete everything above! Is this okay? 🚨" -echo -n "[y]es/[N]o: " -read answer -if [ "$answer" != "${answer#[Yy]}" ]; then - # Remove ignored files to reset repository to pristine condition. Previous - # test ensures that changed files abort the plugin build. - status "Cleaning working directory... 🛀" - git clean -xdf -else - error "Fair enough; aborting. Tidy up your repo and try again. 🙂" - exit 1 +to_clean=$(git clean -xdf --dry-run) +if [ ! -z "$to_clean" ]; then + echo $to_clean + warning "🚨 About to delete everything above! Is this okay? 🚨" + echo -n "[y]es/[N]o: " + read answer + if [ "$answer" != "${answer#[Yy]}" ]; then + # Remove ignored files to reset repository to pristine condition. Previous + # test ensures that changed files abort the plugin build. + status "Cleaning working directory... 🛀" + git clean -xdf + else + error "Fair enough; aborting. Tidy up your repo and try again. 🙂" + exit 1 + fi fi # Download all vendor scripts