From 9ceb311bf70cae55c0428b1df091ec21d2a86ca8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C8=98tefan=20Talpalaru?= Date: Wed, 16 Sep 2020 17:46:05 +0200 Subject: [PATCH] better handling of Ctrl+C during `make update` (#1588) --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index e5dab8e67..a3bc20a17 100644 --- a/Makefile +++ b/Makefile @@ -78,10 +78,15 @@ TOOLS_CSV := $(subst $(SPACE),$(COMMA),$(TOOLS)) ifeq ($(NIM_PARAMS),) # "variables.mk" was not included, so we update the submodules. +# +# The `git reset ...` will try to fix a `make update` that was interrupted +# with Ctrl+C after deleting the working copy and before getting a chance to +# restore it in $(BUILD_SYSTEM_DIR). GIT_SUBMODULE_UPDATE := git submodule update --init --recursive .DEFAULT: +@ echo -e "Git submodules not found. Running '$(GIT_SUBMODULE_UPDATE)'.\n"; \ $(GIT_SUBMODULE_UPDATE) && \ + git submodule foreach --quiet 'git reset --quiet --hard' && \ echo # Now that the included *.mk files appeared, and are newer than this file, Make will restart itself: # https://www.gnu.org/software/make/manual/make.html#Remaking-Makefiles