From eb528f6c9e550bdadf4b8fe742985340041fbfac Mon Sep 17 00:00:00 2001 From: The-going <48602507+The-going@users.noreply.github.com> Date: Mon, 18 Mar 2019 11:54:07 +0300 Subject: [PATCH] Fix: incomplete cleaning of the source code. Before you begin the compilation process, we should always check and clean the sources. If not, then warn the user. --- lib/general.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/general.sh b/lib/general.sh index 8dcffc6607..a8b1fcac7a 100644 --- a/lib/general.sh +++ b/lib/general.sh @@ -260,9 +260,17 @@ fetch_from_repo() elif [[ -n $(git status -uno --porcelain --ignore-submodules=all) ]]; then # working directory is not clean if [[ $FORCE_CHECKOUT == yes ]]; then - display_alert "Checking out" + display_alert " Cleaning .... " "$(git status -s | wc -l) files" + + # Return the files that are tracked by git to the initial state. git checkout -f -q HEAD + + # Files that are not tracked by git and were added + # when the patch was applied must be removed. + git clean -qdf else + display_alert "In the source of dirty files: " "$(git status -s | wc -l)" + display_alert "The compilation process will probably fail." "You have been warned" display_alert "Skipping checkout" fi else